Ubuntu / Linux news and application reviews.

VirtualBox hard disk

If you want to use an existing VirtualBox hard disk (.vdi) for multiple machines you can't just copy the .vdi as you can't have multiple virtual hard disks with the same UUID on the same computer. But luckily you can easily clone an existing VirtualBox hard disk - here's how to do it.

Firstly you'll need to know the path to the .vdi you want to clone. These are usually under ~/VirtualBox VMs (for the latest VirtualBox 4.0) or ~/.VirtualBox/HardDisks.

Once you find the .vdi you want to clone, simply run the following command in a terminal:

VBoxManage clonevdi /path/to/existing.vdi new.vdi

In the above command, replace "/path/to" with the path to the existing .vdi you want to clone and "new.vdi" with the name of the new VirtualBox hard disk.

That's it! You can now use VirtualBox to create a new Virtual Machine with the newly created virtual hard disk.

Update: here's an easier way of doing this (thanks to 1dollar for the tip!): simply create a copy of a .vdi and run the following command to change its UUID:
VBoxManage internalcommands sethduuid copiedfile.vdi