TechTip: P2V on a Tight Budget

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Convert your physical Windows XP workstation to a virtual machine.

 

Virtualization has recently become ubiquitous and is rapidly gaining ground in complex data centers as well as on personal computers. One concept that you may have encountered in the context of virtualization is physical to virtual (P2V) system migration. P2V boils down to a process that allows you to take a snapshot image of a fully functional physical system, inject the drivers and configuration artifacts required by the target hypervisor, and deploy the image in a virtual machine (VM). Here are some obvious benefits of running your workload in a virtual machine rather than on a physical system:

 

  • Live partition migration and high availability
  • Ability to take advantage of the latest hardware technologies, such as faster CPUs, faster storage subsystems, and faster network access
  • Ease of cloning for backup and disaster recovery purposes

 

I strongly recommend that the production environments utilize one of the available commercial P2V solutions, such as Tivoli Provisioning Manager for Images (TPMforI). Individual users and early adopters can, however, perform P2V migrations with open-source tools at no cost. So if your budget is tight, keep on reading.

 

In this tutorial, I walk you through the steps necessary to convert your physical Windows XP workstation into a fully functional and performance-tuned virtual system that can be run under the control of Kernel-Based Virtual Machine (KVM), a Linux-based open-source hypervisor.

Preparing the Physical Windows XP Workstation for Migration

The virtual machine will appear to the Windows XP image as a different system, with different disk and network devices. It is a well-known issue that Windows does not like to be moved to a different physical system. The same consideration applies when moving to a virtual system. There is, however, a simple remedy that can eliminate a lot of the driver incompatibility issues. Luckily, the virtual hardware exposed by the hypervisor appears to Windows as standard devices. So all you need to do is to make sure that the necessary device drivers are loaded on the physical system and that the Windows registry has been updated with the additional drivers' info.   

 

Follow the steps described in the Microsoft Knowledge Base document to merge the registry info and copy the drivers for all IDE controllers that are natively supported by Windows XP.

Creating the Physical System Snapshot

A snapshot is a binary image of your bootable hard drive. Several methods can be employed to perform this task. The easiest approach is outlined below:

 

  1. Download one of the smaller Linux distributions, such as Knoppix, and create a bootable CD.
  2. Attach an external hard drive to your workstation—for example, through a USB port.
  3. Boot the workstation from the CD you created in step 1.
  4. Run the following commands from the Linux prompt:

 

fdisk -l

 

This command lists the partition information for all the hard drives attached to the system. Typically, the Windows drive appears as a device named sda and the USB-attached drive as sdb. Run the following command to copy the content of the Windows hard drive to a file on the USB-attached drive:

 

dd if=/dev/had of=/Images/my-ws.img

 

The copy process takes about an hour for a 100GB source drive. Your mileage will vary depending on your particular hardware configuration.

Deploying the Image to a KVM Host

Copy the image to the image repository of a KVM host. Then, on the KVM host on which you wish to run the image, execute the following command:

 

/usr/bin/qemu-system-x86_64 -m 2048 -boot c -drive file=/var/Images/my-ws.img,if=ide,index=0 -net nic,macaddr=52:54:00:47:80:e9,vlan=0 -net tap,vlan0 -vnc 127.0.0.1:1

 

Modify the above command to reflect your actual environment. Note the location of the image file. The example also assumes that the KVM host uses the network bridge. See KVM documentation for the details.

 

Once the virtual machine is successfully started, you can attach to it using VNC, as shown below:

 

vncviewer 127.0.0.1:1

 

From now on, you should be able to log into your workstation image and use it as if it were running on your physical workstation.

Setting Up the Virtio Drivers

The paravirtualized virtio drivers available for Windows guests can dramatically improve the network and storage throughput, so I strongly recommend installing them. As of this writing, the block virtio driver available on the official KVM Web site does not work on Windows XP clients, so we need to split the setup into two phases.

Installing the Network Virtio Driver

Download the ISO image containing the network virtio driver to a directory on the KVM host—for example, /Install_Images/virtio. Now restart the virtual machine, attaching the downloaded ISO as a CD drive and adding the model=virtio switch to the –net parameter. This instructs KVM to attach a new virtual network adapter to the virtual machine. An example command is shown below:

 

/usr/bin/qemu-system-x86_64 -m 2048 -drive file=/var/Images/my-ws.img,if=ide,boot=on -drive file=/Install_Images/virtio/KVMNet.iso,if=ide,media=cdrom -net nic,macaddr=52:54:00:47:80:e9,vlan=0,model=virtio -net tap,vlan=0 -vnc 127.0.0.1:1

 

When the VM is booted, the Windows guest recognizes that a new device has been attached and the Found New Hardware wizard appears. Use the "No, not this time" option to decline the Windows Update search and then select the "Install from a list or a specific location" option. Navigate to the location on the CD drive where the Windows XP driver is and install it.

Installing the Block Device Virtio Driver

We'll use an approach similar to the one for the network driver but with a little twist required by Windows XP. Download the ISO image containing the corrected version of the Windows XP block driver. Now, you need to trick Windows into allowing you to install this new driver. For this to happen, create a dummy disk image using the following command:

 

qemu-img create –f qcow2 /var/Images/dummy.qcow2 1G

 

Restart the virtual machine, attaching the downloaded ISO as a virtual CD drive and the dummy drive. Remember to set the if=virtio switch on the -drive parameter. This instructs KVM to attach a new virtual hard drive to the virtual machine. An example command is shown below:

 

/usr/bin/qemu-system-x86_64 -m 2048 -name vmwxp -drive file=/var/Images/my-ws.img,if=ide,boot=on -drive file=/var/Images/dummy.qcow2,if=virtio -drive file=/Install_Images/virtio/viostor-xp-2010-02-06.iso,if=ide,media=cdrom -net nic,macaddr=52:54:00:47:80:e9,vlan=0,model=virtio -net tap,vlan=0 -vnc 127.0.0.1:1

 

Again, when the VM is booted, the Windows guest recognizes that a new drive has been attached and presents the Found New Hardware wizard. Use the procedure outlined in the previous section to install the block virtio driver. Shut down the VM and restart it, modifying the if switch on the –drive parameter for the bootable drive. This is illustrated below:

 

/usr/bin/qemu-system-x86_64 -m 2048 -name vmwxp -drive file=/ var/Images /my-ws.img,if=virtio,boot=on -net nic,macaddr=52:54:00:47:80:e9,vlan=0,model=virtio -net tap,vlan=0 -usb -vnc 127.0.0.1:1

 

You can verify that the virtio drivers are functioning properly by inspecting the Device Manager dialog in the running VM. This is shown in Figure 1.

 

052110JarekFigure1

Figure 1: You can see your virtio drivers in your Windows XP virtual machine.

 

That's it! Now you have a fully functional Windows XP virtual machine utilizing well-performing virtio drivers for networking and storage access.

 

 

Jarek Miszczyk

Jarek Miszczyk is a Lead Technical Consultant for System x Virtualization and Cloud Computing at the IBM STG Global ISV Enablement organization. He is located in Rochester, Minnesota. He can be reached by email at This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: