Changing UUID for VirtualBox virtual machines

I am a big fan on developing on virtual machines. This gives me freedom on which VM I am working on (based on current project) and also possibility to ease backup and restore. VMs also give me environment which is closer to customer environments as I am using WIndows Server as OS and other nice features. Using VMs is also great form of avoiding problems with lots of Sitecore instances on one machine and filling in memory, CPU, and so on with lots of processes.

I am using Oracle VirtualBox instead of Microsoft Hyper-V as it has more features for me currently.

I am usually just copying VMs through Windows Explorer to create a new project / VM and then the VMs have the same UUID.

This causes trouble as you cannot attach another VM with same UUID as they are colliding.

You will get this kind of exception in Oracle VirtualBox when you try to add another VM with same UUID:

Cannot register the hard disk ‘C:\_VMs\SC9u2\sc9u2.vdi’ {ca2bdc6a-a487-4e57-9fcd-509d0c31d86d} because a hard disk ‘C:\_VMs\SC9u2\sc9u1.vdi’ with UUID {ca2bdc6a-a487-4e57-9fcd-509d0c31d86d} already exists.

 

There is however easy way how to avoid and fix this.

Follow these steps (note to my future self :-)):

  1. Open Command Prompt and navigate to folder where you have installed Oracle Virtual Box. For me it was “C:\Program Files\Oracle\VirtualBox”
  2. Type in this command (put path to VM which you would like to change UUID between “” ) :
    VBoxManage internalcommands sethduuid "C:\_VM\SC9u1\sc9u1.vdi"
  3. Message appears on your screen -> UUID changed to: 2092c763-22e6-4617-970a-4cdb56e7743c
  4. Done!

 

Happy virtualization!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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