This article describes the migration of OpenVZ Containers in a SolusVM cluster and some errors which you are commonly facing while migrating OpenVZ containers. Here, I am showing some easy steps to moving OpenVZ containers.
Migrating containers & converting /vz Container file system : OpenVZ
If you want to migrate an OpenVZ Container from “NODE A” to “NODE B”, you need to connect between the node that hosts the container (NODE A) and container that you want to migrate (NODE B). Below script file help you to complete this task.
On NODE A
chmod a+x keyput.sh
./keyput.sh destination-ip destination-port
Now you can start the migration. In openVZ, “vzmigrate” is the command which we are using to migrate the container.
vzmigrate -v –ssh=”-p destination-port” destination-ip container_id
Now you have completed the migration of container from “NODE A” to “NODE B”. You can also use some flags while using vzmigrate command. Here I am going to mention some important flags.
-r, –remove-area yes|no
Whether to remove container on source host after successful migration.
This flag is used to perform online migration. If you want “zero down-time”, you can use this flag.
Final step is the solusVM master updating. You need to update the solusVM master so it knows where the VPS has been moved to. Login to the SolusVM Master and run the following command.
/scripts/vm-migrate [VSERVERID] [NEWNODEID]
VSERVERID is the ID listed in your VM list in SolusVM NEWNODEID is the ID of the node in the SolusVM. (Here you need to find out the ID of “NODE B”)
Now We can discuss about some errors which you are commonly facing while migrating openvz Containers. If we migrate a vps from “NODE A’ which is using ext3 filesystem for /VZ to “NODE B” which is using ext4 filesystem. In this case, you may get below error.
Error in check_mount_restrictions (ploop.c:1536): The ploop image can not be used on ext3 or ext4 file system without extents
Failed to create image: Error in check_mount_restrictions (ploop.c:1536): The ploop image can not be used on ext3 or ext4 file system without extents 
Destroying container private area: /vz/private/1332441
Creation of container private area failed
The solution is to convert /vz from ext3 to ext4.
Check below, how to convert /vz from ext3 to ext4. First we should understand that, Ploop doesn’t work on ext3 filesystem.
Stop virtualization services:
Code: [root@]# service vz stop
Remove /vz/pfcache.hdd partition:
Code: [root@]# rm -rf /vz/pfcache.hdd
Unmount /vz/ partition:
Code: [root@]# umount /vz
Convert the file system:
Code: [root@]# tune2fs -O extents,uninit_bg,dir_index/dev/DEVICE_NAME
Code: [root@]# e2fsck -fDC0 /dev/DEVICE_NAME
Change mounting options in /etc/fstab:
Code:[root@]# mount /dev/DEVICE_NAME /vz
Code:[root@]# grep “/vz” /etc/fstab/dev/DEVICE_NAME /vz ext3 defaults,noatime 1 2
Code:[root@]# vi /etc/fstab
Code:[root@]# grep “/vz” /etc/fstab/dev/DEVICE_NAME /vz ext4 defaults,noatime 1 2
Start virtualization services:
Code: [root@pcs ~]# service vz start
In the above article, we have discussed about migrating container migration and converting /vz Container file system (ext3 to ext4).
Note: Do a backup before attempting this procedure. It may render your system unbootable, and may destroy your data.
I hope this article is helpful to improve your technical knowledge.