The basic principles of P2V conversions are easy to understand. First, you need to turn the contents of your physical machine into an image file. Once you do so, you need to be able to boot from that image file. To accomplish this, make sure that you use the correct kernel. If this sounds daunting, this article will walk you through the basics.
From physical machine to image fileFirst, write your physical server's contents to an image file. I prefer the one-to-one approach: one image file for each disk. If, for example, the server you want to convert has four disks, you need to repeat this procedure four times.
Rebooting the server from a Linux live system is the easiest way to clone the contents of your physical disk to an image file. You can use your distribution's installation disk or use another live system, like Knoppix. After booting your server from the live disk, find the name of the disk that you want to clone. In most cases, fdisk -l provides that information. And typically, a Linux hard disk uses a device file, such as /dev/sda.
After determining the name of your physical
Requires Free Membership to View
Now that the preparations are complete, it's time to clone the disks. To do so, use the dd command. Then, use the following command to write the entire /dev/sda contents to a file with the name sda.img in the /mnt directory:
dd if=/dev/sda of=/mnt/sda.img bs=4096
This step can be time-consuming. It's not uncommon for a 300 GB disk, for example, to take several hours. Do something else and return to the task at the end of the day. Including the disk image file into your Xen configurationAfter creating the image file, you must include it in your Xen configuration. Using the import wizard in the virt-manager application is the easiest way. In the Virtual Machine Manager main interface, click New to create a virtual machine. Next, click Forward, and from the Create a Virtual Machine window, select I have a disk or disk image with an installed operating system. ***figure1
After selecting the operating system that's on the physical server, Virtual Machine Manager will show the summary screen. In this screen, find the disk file that you previously cloned. Then select the appropriate kernel. This last step is crucial: By default, a paravirtualization kernel is selected on some operating systems . On a machine that you have just cloned with P2V, there will be no paravirtual kernel installed by default, so make sure to select Full Virtualization as the virtualization type and you'll be able to start the converted virtual machine in Xen.
About the expert
This was first published in September 2009
Virtualization Strategies for the CIO

Join the conversationComment
Share
Comments
Results
Contribute to the conversation