vmware converter – p2v – partition number must be set for the boot volume
I was trying to archive old machine running RHEL 6.4 on physical server. First idea was to P2V it and then export virtual machine… BUT of course there was some obstacles. At first I’ve tried to use REAR (Relax and Recover) tool to make P2V, then when restoring I discovered, /boot volume comes from multipath and it didn’t really play well… Then I’ve tried Veeam Agent for Linux, however it couldn’t handle that server either, it wasn’t correctly recognizing disk layout. So last bastion, VMWare Converter. Alas it failed as well as it had troubles with /boot volume. I’ve tried to get into rescue mode, recreate /boot volume from scratch but I couldn’t install damn GRUB loader there. Luckily I had original install DVD so I installed OS from scratch and wanted to migrated data from old disk, and then it came to me… I could take /boot volume from fresh install and use VGs from migrated disks! So quickly made minimum 10GB OS install, mounted old VGs, made neccessary changes to etc/fstab and GRUB and it did work with minimal overhead of space (10GB). So here are steps:
1) Clone over disks from old machine onto new VM until it fails with error
2) Get same OS install disk (or atleast similar?)
3) Make fresh, minimal install
4) Mount disk from non-finished machine to new VM
5) Mount migrated VGs in new VM, edit /boot/grub/grub.cfg and /mnt/sysimage/etc/fstab, remember to copy /boot line form current fresh VM /etc/fstab
6) pbase – new VM pzuadm – migrated machine
2) Get same OS install disk (or atleast similar?)
3) Make fresh, minimal install
4) Mount disk from non-finished machine to new VM
5) Mount migrated VGs in new VM, edit /boot/grub/grub.cfg and /mnt/sysimage/etc/fstab, remember to copy /boot line form current fresh VM /etc/fstab
6) pbase – new VM pzuadm – migrated machine
[root@pbase ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_pbase-lv_root 5.5G 1.8G 3.5G 34% / tmpfs 939M 0 939M 0% /dev/shm /dev/sda1 485M 37M 423M 9% /boot [root@pbase ~]# ls -l /dev/mapper/ total 0 crw-rw----. 1 root root 10, 58 Mar 3 09:42 control lrwxrwxrwx. 1 root root 7 Mar 3 09:42 vg_pbase-lv_root -> ../dm-0 lrwxrwxrwx. 1 root root 7 Mar 3 09:42 vg_pbase-lv_swap -> ../dm-1 # after attaching disk [root@pbase ~]# ls -l /dev/mapper/ total 0 crw-rw----. 1 root root 10, 58 Mar 3 09:46 control lrwxrwxrwx. 1 root root 7 Mar 3 09:46 vg_pbase-lv_root -> ../dm-0 lrwxrwxrwx. 1 root root 7 Mar 3 09:46 vg_pbase-lv_swap -> ../dm-1 lrwxrwxrwx. 1 root root 7 Mar 3 09:46 vg_pzuadm-lv_home -> ../dm-3 lrwxrwxrwx. 1 root root 7 Mar 3 09:46 vg_pzuadm-lv_root -> ../dm-2 lrwxrwxrwx. 1 root root 7 Mar 3 09:46 vg_pzuadm-lv_swap -> ../dm-4 [root@pbase ~]# mkdir /mnt/sysimage [root@pbase ~]# mount /dev/mapper/vg_pzuadm-lv_root /mnt/sysimage/ [root@pbase ~]# cat /etc/fstab | grep boot UUID=64d2336b-93cf-454a-8f25-8fc5fc8ba69a /boot ext4 defaults 1 2 # before edit [root@pbase ~]# cat /boot/grub/grub.conf # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/mapper/vg_pbase-lv_root # initrd /initrd-[generic-]version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title Red Hat Enterprise Linux (2.6.32-358.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/vg_pbase-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=vg_pbase/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=pl2 rd_LVM_LV=vg_pbase/lv_root rd_NO_DM rhgb quiet initrd /initramfs-2.6.32-358.el6.x86_64.img # after edit [root@pbase ~]# cat /boot/grub/grub.conf # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/mapper/vg_pzuadm-lv_root # initrd /initrd-[generic-]version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title Red Hat Enterprise Linux (2.6.32-358.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/vg_pzuadm-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=vg_pzuadm/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=pl2 rd_LVM_LV=vg_pzuadm/lv_root rd_NO_DM rhgb quiet initrd /initramfs-2.6.32-358.el6.x86_64.img # before edit [root@pbase ~]# cd /mnt/sysimage/etc/ [root@pbase etc]# cat fstab # # /etc/fstab # Created by anaconda on Tue Feb 11 16:38:25 2014 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/vg_pzuadm-lv_root / ext4 defaults 1 1 /dev/sdb1 /boot ext4 defaults 1 2 /dev/mapper/vg_pzuadm-lv_home /home ext4 defaults 1 2 /dev/mapper/vg_pzuadm-lv_swap swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 # after edit [root@pbase etc]# cd [root@pbase ~]# umount /mnt/sysimage/ [root@pbase ~]# reboot [root@pzuadm ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_pzuadm-lv_root 50G 24G 24G 50% / tmpfs 939M 0 939M 0% /dev/shm /dev/sda1 485M 37M 423M 9% /boot /dev/mapper/vg_pzuadm-lv_home 44G 181M 41G 1% /home
great content! smartparaphrasingtool.com I found your blog on google and loved reading it greatly. It is a great post indeed. Much obliged to you and good. keep it up..
ReplyDeleteThanks Jack, I will update with new nuggets soon. In the meantime, check reddit r/vmware for great q/a.
ReplyDelete