Sept. 17, 2010, 3:39 p.m.

Migrating Linux to Parallels VM

So you want to get your Linux physical machine running inside a virtual machine under Parallels Desktop for Mac? The straight forward way would be to use Parallels Transporter Agent on the Linux machine, however for me under Ubuntu 10.04.1 x64 it caused the machine to forever hang at the "Gathering information" screen... And if you kill the agent then Ubuntu hangs and refuses to restart. I clearly needed a different tactic.

What I did to get my Ubuntu Linux 10.04.1 x64 running happily inside my new Parallels Desktop for Mac 6.0, was the following:

  1. On the source Linux machine, as root dump the whole hard disk (not a partition - the WHOLE disk)

    dd if=/dev/sda of=/mnt/backup/ bs=65536 

    Obviously substitute /dev/sda for your primary hard drive you want to copy, and /mnt/backup/ for the destination file to be created. There needs to be sufficient free disk space on that target mount point to contain the source hard disk's capacity.

  2. Copy the file /mnt/backup/ to a filesystem the Mac has access to, and that has 120% the free capacity of the hard disk image you are copying. Tip: If you use a USB2.0 drive and have more than a 200GB HDD, be prepared to wait a couple of days for the next process. eSata and FW800 are your friends.
  3. On the Mac, create a new Virtual Machine. Select Hard Disk 1 as this .hdd file you made available to the Mac.
  4. The system will ask you to convert the old format HDD file to the new format. Accept this choice.
  5. Boot the VM.
  6. Install Parallels Tools.
  7. Reboot the VM.

You could be done, but in my case my Linux physical machine used a 1TB HDD, and I do NOT have room for a 1TB VM, and my actual data only consumed about 250GB. My Linux machine dual booted with Windows 7. So here is what I did:

  1. Run fdisk in the VM.
  2. Delete the Windows 7 partition.
  3. Ensure grub is installed in the MBR and not the Windows partition of course.
  4. Save and shut down the OS in the VM
  5. Go to hardware configuration for the VM, and change the disk to an expanding disk type. This is very important in order to be able to reduce the size. This step might take 10 hours or more.
  6. Once done, click compress.
  7. Boot the VM. It should ask you to compress it to reduce disk space.
  8. This step will also take a while, about 3-4 hours.
  9. You're done!