Migration of a VPS from one node to another using dd image backup (KVM)

Share it:


DD Migration steps.

1) Take the backup of the Source VPS image using the below pasted command.

========================
dd if=/dev/vmstore-1/vsv1016-0jkr-wcry6okz0ww56wtr bs=512K |gzip -c > testbackup.gz
========================

/dev/vmstore-1/vsv1016-0jkr-wcry6okz0ww56wtr >> This file is diff for every VPS. you need to check the appropriate volume group from the server using the command "lvs". Depending on the VPS ID the file name (vsv1016-0jkr-wcry6okz0ww56wtr) will change.

testbackup.gz >> backup file name.


2) SCP the backup to destination server (scp -P7576 testbackup.gz root@64.62.143.90:/ )

3) Create the VPS in destination server with the same configuration and using the test IP make the destination VPS UP.

4) Run the restoration command.

=====================
dd if=testbackup.gz | gzip -c -d | dd of=/dev/mapper/sata--store--1--vg-vsv1024--0dz0--7gfx8xqyc7l1omby
=====================

/dev/mapper/sata--store--1--vg-vsv1024--0dz0--7gfx8xqyc7l1omby >> "/dev/mapper/"  is commonn for all the VPS, to find the VG you need to use "ls -l" command ( ls -l /dev/mapper/) and check with the VPS ID. Here in example the VPS ID is  1024.

5) Once the restoration is completed, you need to stop the destination VPS and start the same. You can monitor the VPS reboot using the VNC.

6) IF the destination VPS is not UP, then you need to run fsck from the VNC console.

7) After the VPS is online, then you need to check the disk space of both VPS and confirm the same.

8) Run rsync command to sync home folder and MySQL folder

rsync -avz --progress --numeric-ids -e 'ssh -p7576' /home/* root@184.105.237.252:/home/

rsync -avz --progress --numeric-ids -e 'ssh -p7576' /var/lib/mysql/* root@184.105.237.252:/var/lib/mysql/



9)After that, stop the Source VPS and assign the source VPS IP to the new VPS and reboot the same.


After IP switching, you may need to restart the network. while doing the restart there may be a chance of the occurrence of the bellow error.

/etc/init.d/network restart
Shutting down loopback interface:
Bringing up loopback interface:
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.

eth0 never comes up and obviously you have got no access to / from the network.

Fix the problem by deleting the /etc/udev/rules.d/70-persistant-net.rules file and restarting the virtual machine which generated a new file and got every thing set up correctly.

Share it:

Post A Comment:

0 comments: