How to Copy a VirtualBox Virtual Machine in Ubuntu

VirtualBox can be a handy tool when playing with configurations and testing things out. You can create a base image, make several copies and start playing around and messing things up. Since you made copies you can always go back to your original and start from ground zero.

Creating a copy of an existing Virtual machine in VirtualBox is just about as simple as copying a file. However we will need to assign a new UUID to the copied virtual machine. This will require us to issue a few commands in the terminal.

 

 

Vitualbox UUID already exsist - Error Message

 

 

 

Copying a Virtual Machine File:


Navigate to your home directory

Press “CTRL + H

(To Show Hidden Files)

Open folder .VirtualBox

Open folder HardDisks

Right click on the virtual machine you would like to copy and select copy

 

 

Right Click on Virtual Machine Hard Drive .VDI and select copy (VirtualBox)

 

 

Right click in the folder and select paste

 

 

Paste Copy of VirtualBox HardDrive .VDI

 

 

Right Click on the copied file and Rename it to what every you feel appropriate.

 

 

Rename your copy of your VirtualBox hard drive (.VDI)

 

 

 

 

Changing the UUID of the copied Virtual machine file:


 

VirtualBox can not have more then one virtual machine with the same UUID. If you just make a copy and not assign a new UUID you will get an error message similar to below.

disk '/.VirtualBox/HardDisks/ubuntu.vdi' with UUID {77d55d86-800c-4667-9e60-678f81a50913} already exists

Lets assign a new UUID so we can start using are copied virtual machine.

Go to Applications > Accessories > Terminal

 

 

Launch A Terminal by going to Applications > Accessories > Terminal

 

 

Type the following command

cd .VirtualBox/HardDisks

 

 

Change Directory to .VirtualBox/HardDisks  | cd ./VirtualBox/HardDisk

 

 

Then Issue the following command changing the end part (ubuntu 10 test.vdi ) to match the new virtual machine name. Note: If you have a space in the name you will need to add “” around the name of your new virtual machine.

vboxmanage internalcommands setvdiuuid "ubuntu 10 test.vdi"

 

 

vboxmanage internalcommands setvdiuud "vdiname.vdi"

 

UUID Changed to

 

 

 

 

 

Importing the copied virtual machine into VirtualBox:


 

launch VirtualBox

Select New

 

 

Launch VirtualBox and Click New

 

 

Select Next

 

 

Click Next

 

 

Create a Name and select the operating system that best matches your guest OS.

 

 

Create A Name for your copy VirtualBox Image

 

 

Set the amount of Ram you would like the machine to use

 

 

Set the Amount of Ram for your virtual machine

 

 

Select use existing hard disk - Click on Folder Icon

 

 

Select Use exsisting hard disk

 

 

Select Add

 

 

Add The New Disk

 

 

Browse to your new copy you created

 

 

Select Your Copied .vdi file

 

 

Click on Select

 

 

Click on Select

 

 

Click Next

 

 

Select Next

 

 

Click Finish

 

 

Click Finish

 

 

You should be should be all set. You can now make setting changes before launching your newly copied virtual machine. Once you have it configured the way you want it, fire it up and test it out.

 

 

New Copy of Virtual Machine Up and Running

 

 

Hope you found this helpful!