Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know of 2 ways to clone a VirtualBox machine on a linux host, one is by using the VirtualBox gui and exporting and re-importing as appliance (in the file menu of VirtualBox).

The other is by cloning only the virtual disk container files:

VBoxManage clonevdi /mnt/md1/original/root-fs.vdi /mnt/md1/cloned/root-fs.vdi

(Taken from )

Edit: this does not seem to work for VDI files that are already part of ~/VirtualBox/VirtualBox.xml, I get an error message:

ERROR: Cannot register the hard disk '/mnt/md1/original/root-fs.vdi' with UUID {96a1462b-c30a-4911-a954-d9093122f083} because a hard disk '/mnt/md1/original/root-fs.vdi' with UUID {96a1462b-c30a-4911-a954-d9093122f083} already exists in the media registry ('/home/mit/.VirtualBox/VirtualBox.xml')

I would have to create a new VM afterwards and use the cloned virtual disk containers.

Is it also possible to clone a VM by copying the virtual disk contianer files and the config files using filesystem commands and do the rest by hand?

I'd have to manually edit the ~/VirtualBox/VirtualBox.xml and insert a new disk and a new machine:

Can I just make up UUIDs or how would this work?

I would very much prefer this hardcore method of doing things as it allows me to freely and rapdily backup, restore, move or clone machines. Or ist there a better way to do this?

share|improve this question
up vote 4 down vote accepted

You can change the UUID of a vdi using the command

VBoxManage internalcommands setvdiuuid disk.vdi

or if you are using VBox V4.x at least to 4.0.10

 VBoxManage internalcommands sethduuid disk.vdi

then use the GUI import the new 'unique' disk.

If you want to clone a particular VirtualBox machine then you are probably better off making an appliance of it and then using it. To make an appliance use the GUI Export Appliance feature or the vboxmanage export command. The resultant appliance can then be imported using the GUI Import Appliance feature or the vboxmanage import command.

share|improve this answer
+1 million if I could. Note, in my version (4.x) this is "sethduuid", not "setvdiuuid". – Mike Jul 11 '11 at 19:49
@Mike: Cheers - updated to reflect changes – Iain Jul 11 '11 at 20:29

Or you can edit the "Virtualbox.xml" setupfile with the right uuids for the machineid. Worked great for me moving a virtual machine from one host to another (both hosts being 64-bits linux, no idea if it had worked moving to e.g. windows or mac) see for details.

This works even if the vboxmanager on the original host for some reason can not be run.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.