Howto create a Virtualbox 4 image clone

VirtualBox 4 for multiple OS availability
If you are like me and do a lot of testing with Virtual Machines, then you will know that to keep having to create a new machine and installing a Debian netinstall each time is a complete p.i.t.a

Cloning vdi’s
No need for all that malarkey now. Just create a fresh VM, install a base Debian netinstall, or any other OS for the matter, i’ve got loads installed!

Once you have it all setup, shut down VirtualBox, open your terminal and issue a command like this:

vboxmanage clonevdi /home/rich/VirtualBoxVMs/Squeeze64/Squeeze64.vdi /home/rich/VirtualBoxVMs/Squeeze64b/Squeeze64b.vdi

As you can see, all my vdi’s are stored in /home/rich/VirtualBoxVms so just adapt the command to suite your needs.

The output will be like this (with a new uuid created for the harddisk):
Clone hard disk created in format 'VDI'. UUID: cc76ae5a-719a-4833-b481-42f254f5fe2e

So, imagine you want to create a new Debian clone called “MyBigFatCopy”.

cd /directory/where/your/vdis/are/stored/
mkdir MyBigFatCopy

Now run the code from before:

vboxmanage clonevdi /home/you/VirtualBoxVMs/ORIGINAL/original.vdi /home/you/VirtualBoxVMs/MyBigFatCopy/mybigfatcopy.vdi

Adding your new clone to the VirtualBox list
Now open up VirtualBox4, choose “NEW” and create a VM called MyBigFatCopy

(**NOTE** It has to have “exactly” the same name as the directory you just created).

Instead of creating a new harddrive, just choose an “existing” vdi, yup, you’ve guessed, navigate to your newly cloned mybigfatcopy.vdi 🙂

Finish off, restart VirtualBox4, and fire up your new mybigfatclone.

If you are on a network (or want to run several VM’s at the same time), just make sure you change the hostname, and if it has a static IP address, change it to dhcp or a new static ip. Now you can fire up your clone alongside your original without any problems.

Happy Cloning! 😉


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s