How to change the UUID in VirtualBox HDD

You have tried copying, moving, or backing up and restoring your VirtualBox virtual machines. But now one or more of these virtual machines are unable to boot because of some UUID related issues.

You have tried copying, moving, or backing up and restoring your VirtualBox virtual machines. But now one or more of the virtual machines (VMs) cannot boot because of some UUID related issues.

When setting up the virtual machine in VirtualBox, it will be provided with a Universal Unique IDentifier (abbreviated as UUID). This is a 128-bit number, reserved for virtual hardware. Here, the HDD attached to the created virtual machine also has its own UUID.

How to change the UUID in VirtualBox HDD Picture 1
Virtual machines are provided with a unique UUID

The most common scenario may appear after you try to copy or back up a virtual machine. When trying to run the second version, the second version of the VM, VirtualBox may notice that the HDD UUID is not the version it was waiting for.

You should reset the UUID of the HDD and re-attach it to the VM as a new device. This is easy to do but requires the use of the command line tool, along with a few clicks in the rarely accessed part of the GUI on VirtualBox.

Learn VboxManage

VirtualBox comes with a command line tool, VboxManage, to help you manage your virtual machines.

VboxManage is a command-line interface for the program, providing a lot of functionality not found in the main GUI-based application. With VboxManage, you can create new virtual machines, modify their parameters, copy them or reset the UUID of the HDD.

How to change the UUID in VirtualBox HDD Picture 2
You can do many things with VboxManage

If you have VirtualBox, then VboxManage is already installed. To check, enter in the terminal:

 vboxmanage 

Remove the HDD

From the main window of VirtualBox, with the VM stopped, select File> Virtual Media Manager .

From the window that appears on the screen, identify the problematic hard drive. Click on it to select. Then, click the 'Release' button to separate the selected HDD from VirtualBox. Confirm that you want to remove it when VirtualBox asks if you are sure. Then click on 'Remove'.

VirtualBox will notify you that, because this hard drive is inaccessible, its image file cannot be deleted. Click 'Remove'. If the error message is different, skip this step to avoid actually deleting your virtual hard drive.

Change its UUID

Return to the terminal and enter:

 vboxmanage internalcommands sethduuid FILENAME 

Replace 'FILENAME' with the actual virtual hard drive file.

The program will notify you about the new UUID assigned to the virtual hard drive file.

Reinstall the virtual hard drive

Return to the Virtual Media Manager window and click Add. Find and select the updated virtual hard drive file to reconnect to VirtualBox.

Close the Virtual Media Manager window and review the settings of the virtual machines affected by the problem.

Move to the 'Storage' setting of the virtual machine and select the appropriate controller. Click on the HDD drive icon and the plus sign. Select 'Choose existing disk' and then the virtual hard drive file updated from the pop-up window.

How to change the UUID in VirtualBox HDD Picture 3
Select the updated virtual hard drive file from the pop-up window

Click OK to save the changes and exit the window. Start the virtual machine and, if everything goes as planned, it will boot without any problems.

« PREV
NEXT »