OpenVZ Forum


Home » General » Support » Change files in root or in private?
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 previous 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.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Snort again
Next Topic: Snapshot backups with ploop
Goto Forum:
  


Current Time: Wed Sep 04 16:48:33 GMT 2024

Total time taken to generate the page: 0.06975 seconds