How to move VirtualBox machines to another hard drive

Recently I needed to free up some space on my Mac’s internal hard drive and decided to move my Virtualbox virtual machine disk images to an external drive.

At first I thought it was going to be as easy as just copying the .vdi files to the other drive and then pointing each Virtualbox machine to the new location of its corresponding .vdi file. Turned out it isn’t quite that easy.

For future reference, here’s what I did:

  1. Shut down the machine
  2. Use clonehd to create a clone. Open a Terminal window and enter vboxmanage clonehd [original] [clone], replacing [original] with the full paths to the .vdi file you want to clone and [clone] with the location where you want the clone, i.e. vboxmanage clonehd /VM/ubuntu10.10.vdi /Volumes/ExternalDisk/VM/ubuntu10.10.vdi.
  3. Open VirtualBox and go to Settings - Storage for the machine.
  4. Remove the disk in the Storage Tree.
  5. Add the cloned disk instead.
  6. Start the machine to verify that it works.

The Cloning disk images section of the VirtualBox manual notes that there may be problems with drive IDs and newer Linux distributions. I did not notice any such problems, but YMMV.

Posted on September 22, 2011 in Virtual Machines

Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.