P2V a Linux box into VMWare

This really should be obvious and easy … after all everyone does it … but my Google Fu kept leading me to solutions that relied on having access to old versions of VMWare Converter.

But it really is easy by combining:
  • netcat; and,
  • qemu
P2V is simple.
Step 1: Clone the hard disk from the physical machine over the network:

Set up to receive the data on a convenient destination_host:

nc -l 10000 > sda.dd

Send the data from the machine you want to P2V

dd conv=noerror if=/dev/sda | nc destination_host 10000

Step 2: Convert our disk image into a VMDK

qemu-img convert -pO vmdk sda.dd p2v.vmdk

Step 3: Import into VMWare (in my case VMWare Fusion)

  1. Create a new custom Virtual Machine
  2. Select Use an existing virtual disk
  3. Select your newly created VMDK (I use the copy into the new vm option)

And we have cloned a running physical system with almost no changes into a VMWare virtual machine. Of course you may have issues with open files and file systems being modified … but if this is an actual issue you can always boot a live distribution and transfer the quiescent disk.