OpenVZ Forum


Home » General » Support » Change files in root or in private?
Change files in root or in private? [message #51255] Wed, 26 March 2014 01:25 Go to next message
postcd is currently offline  postcd
Messages: 73
Registered: April 2013
Member
Hello,

when i want to make some permanent change in VPS files, i need to edit in:

/vz/private

or in

/vz/root

?

im afraid when i stop and start vm if i dont change any temporary working VM folder and changes will be reverted? just to be sure, thats why im asking. thank you
Re: Change files in root or in private? [message #51261 is a reply to message #51255] Thu, 27 March 2014 00:12 Go to previous messageGo to next message
Ales is currently offline  Ales
Messages: 330
Registered: May 2009
Senior Member
Editing the VM files from outside the VM is tricky, but can be done.

The safe approach is to:
- stop the VM
- mount the VM's file system ('vzctl mount VMID')
- do the changes to /vz/root/<VMID>
- umount the VM's fs
- start the container again.

When the container is simply stopped, the /vz/root/<VMID> will not be mounted and therefore empty. At that time you can also safely edit files under /vz/private/<VMID>, but you will cause a second level quota discrepancy. Basically, quotas within the VM will be wrong. The solution is to later drop and recalculate the quotas for the VM.

If the VM is running you must not edit /vz/private/<VMID> and you can edit /vz/root/<VMID> ...BUT... there is a chance of file corruption.

Imagine: the VM's OS has a file opened, at the same time some outside force changes the file, then the OS saves it again, without knowing it was changed... So... you can edit /vz/root/<VMID> while the container is running, but I would do it only if absolutely necessary and if I was reasonably sure the file is safe to edit...

Just a note to others who might stumble on this thread later: for backup purposes, always backup /vz/private/<VMID>, even if the VM is running.
Re: Change files in root or in private? [message #51274 is a reply to message #51255] Sat, 29 March 2014 07:28 Go to previous messageGo to next message
Paparaciz
Messages: 302
Registered: August 2009
Senior Member
spoon feeding.
http://forum.openvz.org/index.php?t=msg&goto=51183

postcd stop spaming forum.
Re: Change files in root or in private? [message #51275 is a reply to message #51255] Sat, 29 March 2014 07:31 Go to previous messageGo to next message
Paparaciz
Messages: 302
Registered: August 2009
Senior Member
and this is last time I ask you to stop spam forum
Re: Change files in root or in private? [message #51276 is a reply to message #51255] Sat, 29 March 2014 10:12 Go to previous message
postcd is currently offline  postcd
Messages: 73
Registered: April 2013
Member
Thx for helpfull post Ales,

Papa.: I have a question on which i did not found answer, so i will ask it. If you cant stend it, its your issue, no need to write me more.

[Updated on: Sat, 29 March 2014 10:13]

Report message to a moderator

Previous Topic: Snort again
Next Topic: Snapshot backups with ploop
Goto Forum:
  


Current Time: Fri Mar 29 05:25:26 GMT 2024

Total time taken to generate the page: 0.01959 seconds