Converting Parallels VM (And Setting Up) Linux KVM

If you are running a Parallels virtual machine (VM) but want to move it to a VM Linux server running KVM, you’ll need to convert it first.  This explains how to convert it, how to configure (Ubuntu) Linux to run the VM, and optionally how to connect to the new VM on the Linux box from an external computer.

Note: Even if you are using VMWare or VM software, you can use these instructions to move your to a kvm VM instead (just choose a different input format for step C(b) below).

 

Why you might want to do this:

  1. Faster.  Parallels bogs down my Apple computer and I wanted to move it to my HP N54L microserver running Linux Ubuntu 12 server.  This means I can remotely connect to the VM where it’ll be running on an otherwise under-utilised server, instead of running it locally.
  2. Free OSS. Parallels is commercial software, costs money, and doesn’t get the same upgrades that open-source does.
  3. Fun. Because its a pleasure to remotely connect to Windows running on Linux from an Apple computer
  4. Space. Converting to qcow2 format for the VM seems to have halved the size (it may be that it compressed empty space which could have probably been done by Parallels Tools).

What you’ll need:

  • Find the actual Parallels VM file, copy it to it’s new Linux host machine
  • Have installed or install the qemu system package on your Linux host machine
  • Have installed or install KVM on your Linux host machine
  • Run a conversion from the Parallels format to KVM qcow2 format
  • Tell KVM about the new VM

 

Steps to be done:

  1. Locate your Parallels VM hds file and copy it to your Linux machine
      1. In Finder, go to the folder where your virtual machine is stored. By default, it is /<Username>/Documents/Parallels/
      2. Locate the required virtual machine PVM file that you want to convert. (in my case Windows 7.pvm)
      3. Right-click on it and choose Show Package Contents, and in the folder that opens
      4. Right-click on the file with the extension .hdd (in my case Windows 7-0.hdd) and choose Show Package Contents
      5. In the folder that opens you should see a file with the .hds extension, this is the actual VM disk image. (in my case it is Windows 7-0.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41\}.hds)
      6. Copy that .hds file to your Linux machine
  2. Install qemu on the new Linux host machine
    1. On the host Linux machine, from the command-line, run:
      sudo apt-get install qemu-system
      Discussion about installing qemu is here.
    2. If you haven’t installed KVM on your Linux host yet,  you’ll need to – here is a working method for Ubuntu server 12.04
  3. Convert the image
    1. Change to the directory on the Linux host machine where you placed the .hds file.
    2. The qemu package should include the qemu-img file. From the command-line, run the following (substituting xxx for the name of your .hds file
      sudo qemu-img convert -c -p -f parallels -O qcow2  xxx.hds  myNewVM.qcow2
      This should start the conversion, which in my case took a few hours for a 40 GB  hds file.  Man page details on the qemu-img convert command line options is here.
    3. Copy or move the newly created qcow2 VM image to the images directory:
      sudo mv myNewVM.qcow2 /var/lib/libvirt/images
  4. SSH to the Linux host with port forwarding
    1. Start X11 on your Mac – X11 is installed automatically when you install Lion. If you need to download and install it visit http://xquartz.macosforge.org/trac/wiki/X112.6.3
    2. SSH into the linux host with port forwarding
      ssh -X linux_host_or_ip_here
    3. Start the Virtual Machine Manager
      sudo virt-manager
      The VMM window should appear on your Mac as an X11 window
  5. Create the new VM using the qemu Virtual Machine Manager

    1. This IBM DeveloperWorks article shows the GUI and how to create a new VM.  You’ll be choosing Import Existing VM from the New VM window:

      VMM New VM Window

      Creating a new VM in KVM Virtual Machine Manager GUI

    2. When you run the newly created VM, in my case Windows needed to update ~60,000 files I suppose due to the hardware changes on which it was running:

      New VM Startup

      Windows VM Startup First Time After Moving From Parallels

  6. (Optional) To use Microsoft’s Remote Desktop Connection to connect to your new VM (it’s faster than X11 over SSH) from you Mac or any other computer:
    1. Check if you have the apt-get package hal installed.  My Ubuntu 12.o4 server didn’t come with macvtap installed which hal provides.  macvtap is needed as it provides an easy way to have your VM grab a real IP from your router instead of using a virtual-net provided by the host linux machine.  Without this real IP, it’s more difficult for an external machine (as in not the linux host machine running the VM)  to connect to the VM using Remote Desktop. To install hal run:
      sudo apt-get install hal
    2. Then logout out of your linux SSH session and close X11.  Re-login into both and run sudo virt-manager again and when the new window comes up open you VM and go to the details section and select the networking mode shown below (Host Device eth0: (Bridge ‘br0’):
      Bridged Networking KVM

      Bridged Networking KVM

      If your machine is running you’ll need to shut it down and restart it for the changes to take effect.

    3. Enable Remote Desktop in your Windows VM
    4. Allow Windows firewall to pass through Remote Desktop connections from local (and the internet in my case to get it working)
    5. Find your new Windows VM IP address (assigned from your router)
    6. Ping it from your external computer to check that it’s reachable, then use Microsoft’s Remote Desktop to connect to the new Windows VM.

 

Tags: ,

4 Responses to “Converting Parallels VM (And Setting Up) Linux KVM”

  1. ritzo 21. Aug, 2015 at 6:57 am #

    Thanks a lot for your description
    I was following your steps until step E.b. I try to start the converted parallels image with the vm manager and it starts, tells me booting from disk and then noting happend anymore.
    I wait nearly 3 hours.
    How long did it take in your case?
    Do you have any ideas, what could be wrong.
    Thanks a lot for a tipp
    Best regards
    ritzo

  2. J S 21. Aug, 2015 at 7:07 pm #

    Ritzo,
    Sorry, I don’t know why. If you are booting a linux image you can try to see the boot messages right when you start the VM using Ctrl+Alt+F1, all three at the same time. If it’s Windows, I’m not sure where to look if you don’t see any other messages on the screen. In my case, the initial boot was slow for Windows as it reconfigured itself for the new ‘hardware’, however it showed what it was doing on screen.

  3. A.S. 12. Mar, 2017 at 5:36 pm #

    I tried this with Ubuntu 16.04.2 and moved over images from Parallels v11.

    Everything appeared to work as I went through the steps. After all of the conversions and moving, none of the VM’s would boot and gave an error that there was no boot drive. Tried with Windows Server 2003 and Windows 10 Parallels VM’s.

    Everything prior to that seemed to work fine with no errors.

    Thanks…..

  4. J S 17. Mar, 2017 at 10:47 am #

    A.S.

    I’ve moved on to running Docker containers instead of VM’s and a lot will have changed with Parallels/KVM since I wrote this, so I can’t offer any advice.

Leave a Reply