P2V of Linux using Knoppix live CD.

Prerequisites

* Knoppix bootable CD – Latest Version (to be used for Physical machine).
* ISO image of Knoppix CD stored in a VMware Data store.
* Network connectivity between VM and Physical machine.
* At least one network port open (Port 6001).
* Network Access to virtual machine from physical machine.

Preparation…

[ad#co-2]

* Ensure that you have a console access to the physical machine.
* Shutdown the physical machine and Boot it using Knoppix CD. Use following arguments when the CD boots and displays
Knoppix’s logo with a prompt like “boot:” “knoppix 2 noeject noprompt”. It boots Knoppix in text mode and when rebooted neither asks you whether to eject the CD nor ejects the CD automatically.

  • Create a VM with custom settings selected. Type of Guest OS should suit the Linux OS this VM will run. For non-standard or old versions set the Guest OS to “other Linux (32bit)”. Configure all resources as required.
  • Create VMdisks 4-5% bigger in size than Physical Disks.
  • If you are migrating older versions of Linux, choose BusLogic SCSI adaptor instead of default LSILogic.
  • Now set the Knoppix’s ISO image as a boot media for created VM and start the VM. Use following arguments when prompted with “boot:” and Knoppix Logo. “knoppix 2 noeject noprompt”. This will boot Knoppix into text mode.
  • Check the Network connectivity between Physical Machine and VM.
  • Setup the IP addresses for the booted Knoppix OS on both Physical Machine and VM by issuing following command.
  • /sbin/ifconfig eth0 IP netmask MASK up
  • /sbin/route add default gw gateway_IP
  • Verify that the IP address has been assigned, by issuing “ifconfig” command. Also ensure that both can ping each other.

———- Starting Migration ———————————–

[ad#co-2]

  • Once confirmed that both Physical machine and VM can access each other,execute following command on VM.

nc -l -p 6001 | dd of=/dev/sda (Local Hdd device)

  • Then execute following command on Physical Machine. Here it is assumed that the disk in Physical machine is /dev/sda

dd if=/dev/sda | nc VM_IP 6001

  • This will start Block level transfer of Disk Data from Physical Machine to VM.

After Migration of Data………….

  • Once the data has been migrated, shut down the Knoppix environment on VM and Physical Machine.
  • Then configure the VM to use Rescue CD (CD1) iso image as a boot media and start the VM.
  • On the boot prompt, type “linux rescue” to go into rescue mode. Rescue mode automatically searches for Linux compatible partitions in the Local VMdisks and mounts them in “/mnt/sysimage”. Select to mount all the linux partitions available (do not select the read-only mode).
  • On the console prompt, change the current root to /mnt/sysimage using command “chroot /mnt/sysimage”
  • Execute the command “kudzu” to detect and install the drivers for new hardware (VM) automatically. Follow the on-screen instructions to remove the old drivers and install new drivers.
  • Edit /etc/fstab file with your favorite editor. Check the mount points and device name mappings and change wherever required.
  • Edit /etc/lilo.conf and change all the old device names to new device names including the root partition path.
  • Then create new initrd images using following command.

/sbin/mkinitrd -f -v /boot/initrd-kernel-version.img kernel-version
E.g. for kernel 2.6.9 the command will be
/sbin/mkinitrd –f –v /boot/initrd-2.6.9.img 2.6.9

  • Check for symbolic links (if any) in /boot directory. Delete and recreate all symbolic links in /boot directory.
  • Delete the file map from /boot dir and execute following command.

/sbin/lilo

  • Reboot the VM, and once rebooted, stop the VM. Then reconfigure the VM to use LSILogic SCSI adaptor.
  • Start the VM and check whether VM boots properly.

Install VMware tools once the VM starts and reboot it again.

Share

Leave a Reply