How to Duplicate a Virtual Box Image
If like me you use Virtual Box for demo and development environments you will likely want to duplicate existing Virtual Box images at some point. Virtual Box doesn’t like this. Reason for this is each Virtual hard disk is assigned a unique ID and if you simply try a copy and paste your new VDI file will have the same unique ID as the original VDI file and you will get this error:
“Cannot register the hard disk XXXX with UUID YYYY because a hard disk XXXX with UUID YYYY already exists in the media registry blah blah …"
The fix is simple enough though. Open a command prompt and navigate to the Virtual Box installation folder:
Then enter the following, substituting the folder name and file names to localise to the location of your new VDI file:
VBoxManage.exe internalcommands sethduuid "C:\foldername\filename.vdi"
And run that.
Here’s how my mine looks:
If you get it right you will get something along the lines of:
And you’re ready to rock.
Launch Virtual Box, create a new machine, when asked to select a hard disk browse out to your VDI file and select it and then you should be all good.
I’ve had to figure this out twice now and mucking around in a command prompt quickly drives me nuts so next time I’m coming back to this blog.
Regards,
Gareth