How to Clone Ubuntu/CentOS/RHEL VirtualBox VM

It just occurred to me that when running Ubuntu or any other virtual machine OS using Oracle VirtualBox in a lab scenario and you need to install multiple copies of the same OS, it would make sense to create cloned copies of the original VM. VirtualBox does come with a cloning feature to enable you clone the VM but an issue will always arise which is duplicate UUID of the hard disks. There are few approaches to achieving this but the simplest step is outlined below:

Steps:

– First ensure that the VM is shutdown. Next navigate to the location of the .vdi file of the machine. Right-click on the “.vdi” and copy the file to another location. You can name it “ubuntuclone.vdi

ubuntu-clone01

– Next open command prompt in Administrator mode, change directory to location of Oracle VirtualBox install folder (default location is C:\Program Files\Oracle\VirtualBox). Next run the command to set a new UUID for the copied .vdi file

VBoxManage internalcommands sethduuid 'name of copiedfile'.vdi

You should get a message saying “UUID changed to:  xxxxxxx

ubuntu-clone02

So when next you want to create a new Ubuntu VM, go through the creation process but on Hard drive screen, select “Use an existing virtual hard drive file“, click on the folder icon and locate the cloned copy which you changed the UUID above. Note, you can rename the clone copy to a more unique name if you have a naming convention

ubuntu-clone03

Thanks for visiting. Please feel free to share your experience 🙂

 
comments powered by Disqus