I've got an OpenVZ box that's running out of hard drive space. It has a single drive that contains the system and vz partitions. I'd like to install a new drive and move the vz partition to it.

This seems fairly straight-forward, but I wasn't able to find any official instructions, tips, potential problems, etc online. I couldn't even find anyone else talking about doing it, so before I risk messing with a production box I'd like to check if anyone has done this before.

I'm thinking I'll basically do this:

  • Shutdown, install the new drive, boot up, mount the new drive as /vz2
  • Stop OpenVZ services
  • Copy files from the /vz partition to /vz2
  • Unmount both partitions, mount the new drive as /vz
  • Start OpenVZ services, make sure everything is working fine
  • Edit fstab so that the new mount is permanent
  • Reboot to make sure fstab is configured correctly

Does that sound like it'll work? All the locations will remain the same, so the config files shouldn't need to be edited. Are there any non-obvious problems with doing this?


Your plan sounds fine - I've moved VZ volumes between NFS filers using a similar procedure, and it went without a hitch. Make sure you use something like rsync -a or cp -p to preserve all the existing permissions when you copy.


Your procedure seems fine - the only thing I would change is that when you boot up top copy the files you should bring the system up in single-user mode (this should keep OpenVZ from even starting up, and reduces the chances of breaking anything by having some other process you may have forgotten about touching the files).

Also you may want to use tar or dump/restore rather than copying the files (to preserve permissions and other attributes as much as possible)

  • Going into single user for doing a copy is not necessary. You can stop all the containers by running /etc/init.d/vz stop but even that is not necessary - you can make a copy of a container while it's running and nothing bad will happen. – Aleksandr Levchuk Jun 29 '11 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.