How To Virtualize A Physical Linux Machine

This tutorial shows how you can virtualize a physical Linux machine. It is intended not only for virtualization, but for any relocation of a RedHat Linux based system from one machine to another.

Here are the steps to be completed:

1. Install a virtualization software on the desired machine.

2. Create an empty virtual machine with enough disk space, selecting the OS you’re going to migrate.

3. Download a Linux Live-CD ISO (e.g. Knoppix).

4. Burn one copy on a CD and then copy the ISO to the virtualization server (the host).

5. Reboot the original Linux box (the physical machine that you want to virtualize) with the CD you’ve just burnt, and connect the ISO to the newly created virtual machine (i.e., boot the VM from the ISO).

6. Check both live CDs have net connection correctly configured and that they can see each other.

7. In the virtual machine, type this:

nc -l -p 10000 | dd of=/dev/hda

8. On the machine you’re migrating, type:

dd conv=noerror if=/dev/hda | nc $IP_OF_THE_VM 10000

9. Wait until dd finishes its job and do a clean reboot of the virtual machine.

10. Boot in rescue mode with the distro's first CD or DVD and chroot to the new system (on the virtual machine).

11. Run kudzu to remove old devices and find the new ones (or manually edit your /etc/modprobe.conf file, which is the most important since it includes your scsi-device). For SuSE Linux systems, you may need to run yast to discover the new hardware.

12. Create a new init using mkinitrd on your kernel version. Example:

/sbin/mkinitrd -v -f /boot/initrd-2.6.20-1-new.img 2.6.20-1

13. Edit your /boot/grub/menu.lst file to boot your newly created initrd image.

14. Keep your fingers crossed and reboot your VM.

Share this page:

15 Comment(s)