Posts

How to move VirtualBox VHD file to another drive

How to move VirtualBox VHD file to another drive

I use VirtualBox and usually have all my VirtualMachines on a external SSD drive, so that I can easily swap depending on my need. This means that I have to bring either the whole setup along, if I want to work from else where, or bring the VHD along.

How to move VirtualBox VHD file to another drive

  1. Shut down the machine
    1. This means a total shut down
  2. Open a terminal window and enter
    vboxmanage clonehd [path-to/original.vhd] [path-to/cloned-vhd]

    for example:

    vboxmanage clonehd "/external volume/VirtualMachines/ubuntu_dev.vhd" "/Documents/Dev/ubuntu_dev.vhd"
    
  3. Open VirtualBox -> Go to Settings -> Select the machine -> Select machine storage
  4. Remove the disk in the Storage Tree
  5. Now you can add the cloned disk that we created in step to, from the path you specified.
  6. After adding, start the machine to test that the machine is running.

Usage

I use this option when I need to create a template for my VHD file too. As I don’t like to waste space having a template of the VHD laying on a SSD. I have found that this is a very easy way to have a developer environment or test environment. This enables me to quickly be able to load up a new environment from the VHD file laying on an external drive.

I have used this practice for both windows and linux when working with client data. To separate the client data from my own, I create a new environment, which can be deleted when the project is done. This way I do not have to bring a client computer.  As an added benefit I can still work on multiple projects while maintaining a seperation structure within my computer.

VirtualBox or any other Virtual Machine software

If you are unfamiliar with Virtual Machine software and working with VHD files, I would definitely consider using it when working with clients. As my personal computer is a mac, I use VirtualBox, as it is free. However, at work I use windows 8, which comes with Hyper-V. In this post I wrote about how to move VirtualBox VHD file to another drive, with the mac in mind, however, this could just as well have been windows.

Start by setting up a OS of your choice, and configure all the basics. Then create a clone, and use that as a template for future projects.