Physical-to-Virtual (“P2V” or “p-to-v”) involves the process of decoupling and migrating a physical server’s operating system (OS), applications, and data from that physical server to a virtual-machine guest hosted on a virtualized platform.
Virtual to virtual (V2V) is a term that refers to the migration of an operating system (OS), application programs and data from a virtual machine or disk partition to another virtual machine or disk partition. The target can be a single system or multiple systems.
In this scenario, I used VMWare ESXi and already deployed CentOS 7 named VM4
If you want to change password, you copy /etc/shadow to /root then proceed changing to simple password. (as i using vnc)
1. Create new target OS with same specification (CPU, RAM, HDD) with VM4, I named it VM4-v2v
2. Make sure, CentOS is loaded up and boot into rescue mode.
3. Select option 3 to deploy shell access
4. You need to determine the targeted partition and need to be same for destination server. There is some tools that can be used such as fdisk.
There is some cheetsheet that I find online for ext4, ext3 and xfs
7. Assign both server an IP address. In the scenario, I use 192.168.222.2 for VM4 and 192.168.222.3 for VM4-v2v
#VM4 ipaddradd192.168.222.3/24devens224#VM4-v2v ipaddradd192.168.222.2/24devens192#verify it should be ping from both server.[root@localhost ~]# ping 192.168.222.2PING192.168.222.2 (192.168.222.2) 56(84) bytes of data.64bytesfrom192.168.222.2:icmp_seq=1ttl=64time=0.220ms64bytesfrom192.168.222.2:icmp_seq=2ttl=64time=0.264ms64bytesfrom192.168.222.2:icmp_seq=3ttl=64time=0.384ms^C---192.168.222.2pingstatistics---3packetstransmitted,3received,0%packetloss,time1999msrttmin/avg/max/mdev=0.220/0.289/0.384/0.070ms
8. Mount all drive created at destination server
#create directorymkdir/mnt/rootmkdir/mnt/boot#mount partition to directorymount/dev/sda1/mnt/bootmount/dev/sda2/mnt/root#to verifydf-h
9. Start to copy from target server to destination server *command is ran on destination server
#for this, i exclude /boot (because on another partition), /tmp & /proc ssh-p9321[email protected]"tar cvf - /bin /dev /etc /home /lib /lib64 /media /mnt /opt /root /run /sbin /srv /sys /usr /var"|tarxvf--C/mnt/root#for boot partitionssh-p9321[email protected]"cd /boot; tar cvf - *"|tarxvf--C/mnt/boot
10. Edit fstab file to configure partition
vi/mnt/root/etc/fstab#you can use full drive device name or label#device id/dev/sda2/xfsdefaults00/dev/sda1/bootxfsdefaults00#by labelLABEL=//xfsdefaults00LABEL=/boot/bootxfsdefaults00
11. Reboot and put on rescue mode again
Press 1 to continue
#Rescue mode should detect your systemchroot/mnt/sysimage#If rescue mode not detected your partition simplymkdir/mnt/rootmount/dev/sda1/mnt/rootchroot/mnt/root
12. Restore back grub, initrd, intramfs
cd/bootdracutinitramfs-3.10.0-514.el7.x86_64.imginitramfs-3.10.0-514.el7.x86_64-fmkinitrdinitrd-plymouth.img3.10.0-514.el7.x86_64-f#restore grub2grub2-mkconfig-o/boot/grub2/grub.cfggrub2-install/dev/sda#if using old grub vi/etc/grub.conf# and change the line of the kernel version from==========================kernel/boot/vmlinuz-2.6.18-92.1.22.el5roroot=/dev/md4initrd/boot/initrd-2.6.18-92.1.22.el5.img==========================#to ==========================kernel/boot/vmlinuz-2.6.18-92.1.22.el5roroot=LABEL=/initrd/boot/initrd-2.6.18-92.1.22.el5a.img==========================
Reboot and your server should be booting up.
Correct the IP address and host name, and use ipswap to change the IP for directadmin
VMware Tools is a suite of utilities that enhances the performance of the virtual machine’s guest operating system and improves management of the virtual machine.
1. On the host, from the VMware Fusion menu bar, select Virtual Machine > Install VMware Tools. If an earlier version of VMware Tools is installed, the menu item is Update VMware Tools.