Moving OpenVZ /vz partition to separate drive

fstabhard driveopenvzpartition

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?

Best Answer

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.

Related Topic