Tuesday, August 29, 2006

P2V - Virtualizing an existing OS install using PBA

The Personal Backup Appliance VM can be used to move an existing OS install on real hardware to a VM. The process is popularly called "P2V." "P2V" stands for "Physical to Virtual."

If the physical OS install is Linux, all you need to do is backup the OS install onto the PBA VM, create a new VM and then restore the backup into the new VM. You need to make sure you create a VM with the right storage device, either IDE or SCSI, depending on the configuration of your physical OS install.

If you try the same thing with Windows 2000 or Windows XP, things won't go quite as smoothly. In fact, you will get a scary blue screen.

The blue screen occurs because the VMware scsi drivers are not installed. This is a problem that occurs if you use any off-the-shelf disk copying program (e.g. Ghost, etc.) to dupe a real hard disk to a virtual one. The problem isn't limited to PBA.

To make the blue screen go away, you need to inject the scsi drivers and registry changes into the OS install without booting it up. There are several options, that I know of, for doing this.
  1. VMware has a product called Virtual Machine Importer that's in Beta and can be downloaded. It didn't work for me.
  2. VMware has a commercial product called P2V. I didn't try P2V.
  3. There's a free plugin to BartPE Boot CD called Ultimate-P2V. Using Ultimate-P2V to virtualize a windows XP installation worked like a charm. Follow the instructions on this page and build it: http://www.rtfm-ed.co.uk/?page_id=174
Once you have a working BartPE Boot CD with Ultimate-P2V, you can use the Personal Backup Appliance to virtualize your OS install. You can download the Personal Backup Appliance here: http://pba-vm.sourceforge.net

First, power on the Personal Backup Appliance VM. Let it boot to the Ubuntu desktop.

Next, from the physical system:
  1. Boot from the PBA client CD on the computer that you want to virtualize.
  2. At the main menu, select Backup Disk, and enter a filename.
  3. When backup is complete. Power off the system.
Now, we need to create our VM.
  1. Create a new VM with a SCSI vmdk hard disk. Choose Buslogic.
  2. Configure the VM to boot from the PBA client CD iso, then power on the VM.
  3. At the main menu, select Restore Disk and choose the archive that you just created.
  4. When restore is complete. Reboot the VM.
  5. The VM will blue screen when attempting to boot up. This is expected.
  6. Power off the VM.
  7. Configure the VM to boot from your BartPE Boot CD with Ultimate-P2V.
  8. After BartPE boots up, follow the instructions from the Ultimate-P2V site to inject both the Buslogic and LSIlogic drivers.
  9. Shutdown the VM, and let it boot from the hard disk.
If everything went as expected, your desktop from your physical computer should be booting in a VM.

7 comments:

rxhui said...

You can probably use the Personal Backup Appliance to backup the virtualized OS, and then restore it to a real machine.

To create a new VM, you can either use VMware Workstatiom, Server, or use something like http://www.easyvmx.com

The windows blue screen will definitely occur when you virtualize a physical system using IDE into a VM. Not sure about SATA, but I suspect it will also blue screen because the Vmware scsi drivers are still not installed in that situation.

ombre said...

tried to backup a VM machine so that I can restore it to a physical HDD but the process fails with a file format not supported error, but the file format that I tried to backup is
ext3fs which is a supported file format

anybody have any clue what the problem is

Unknown said...

shutdown: you must be root to do that!

What is root's password ?

rxhui said...

In Ubuntu, you can become root using the sudo command.

e.g.

sudo shutdown

or

sudo su

When prompted for a password, enter the password for the vmware user (default password is vmware)

Unknown said...

is it possible to backup a PBA VM and then load that onto a machine as a standard OS?

rxhui said...

I haven't tried this myself, but I think it should work.

Since there's two disks on the PBA VM, PBA will ask you which disk to backup, either /dev/sda or /dev/sdb. Just backup /dev/sda, you don't need to backup /dev/sdb.

This is a rough list of things I would do:

1. Restore the backup to your hard disk on a real machine using PBA. If you are using a SCSI hard disk, that would be easiest, but you can also restore to an IDE hard disk and edit some files to make it boot.
2. If you restored to an IDE disk, you'll need to change all references of /dev/sda to /dev/hda in /boot/grub/menu.lst and /etc/fstab. You may also need to reinstall grub.

3. After restore, the PBA OS installation will only occupy 10GB of hard disk space. Create a data partition with the rest of the hard disk space, and then edit /etc/fstab to mount that partition to /home/vmware/data.

I think that's the essence of it.

Please share with us your results.

Sam said...

I am trying to backup a machine that is located in Raliegh onto a machine that is located at Milpitas, CA. The first steps looked good. it said it successfully backed up /dev/sda1. Then it says "Backing up /dev/sda2" and it hangs. Any idea why?