Как изменить uuid виртуальной машины

I am trying to create a new virtual machine with Oracle VirtualBox, using an already-existing hard disk. When I try to select the existing hard disk file, a .vhd file, it displays an error saying the

I am trying to create a new virtual machine with Oracle VirtualBox, using an already-existing hard disk. When I try to select the existing hard disk file, a .vhd file, it displays an error saying the virtual hard disk cannot be used because the UUID already exists.

So I tried the following command to change its UUID.

VBoxManage internalcommands sethduuid /home/user/VirtualBox VMs/drupal/drupal.vhd

I get this error.

Syntax error: Invalid UUID parameter

How can I resolve this?

apaderno's user avatar

apaderno

27.9k16 gold badges76 silver badges87 bronze badges

asked Jul 23, 2013 at 6:55

CJAY's user avatar

1

The correct command is the following one.

VBoxManage internalcommands sethduuid "/home/user/VirtualBox VMs/drupal/drupal.vhd"

The path for the virtual disk contains a space, so it must be enclosed in double quotes to avoid it is parsed as two parameters.

apaderno's user avatar

apaderno

27.9k16 gold badges76 silver badges87 bronze badges

answered Jul 23, 2013 at 7:21

CJAY's user avatar

CJAYCJAY

6,71717 gold badges61 silver badges103 bronze badges

4

The following worked for me:

  1. run VBoxManage internalcommands sethduuid «VDI/VMDK file» twice (the first time is just to conveniently generate an UUID, you could use any other UUID generation method instead)

  2. open the .vbox file in a text editor

  3. replace the UUID found in Machine uuid=»{…}» with the UUID you got when you ran sethduuid the first time

  4. replace the UUID found in HardDisk uuid=»{…}» and in Image uuid=»{}» (towards the end) with the UUID you got when you ran sethduuid the second time

answered Mar 31, 2016 at 8:24

borchvm's user avatar

borchvmborchvm

3,3547 gold badges43 silver badges42 bronze badges

7

If you’ve copied a disk (vmdk file) from one machine to another and need to change a disk’s UUID in the copy, you don’t need to change the Machine UUID as has been suggested by another answer.

All you need to do is to assign a new UUID to the disk image:

VBoxManage internalcommands sethduuid your-box-disk2.vmdk
UUID changed to: 5d34479f-5597-4b78-a1fa-94e200d16bbb

and then replace the old UUID with the newly generated one in two places in your *.vbox file

<MediaRegistry>
  <HardDisks>
    <HardDisk uuid="{5d34479f-5597-4b78-a1fa-94e200d16bbb}" location="box-disk2.vmdk" format="VMDK" type="Normal"/>
  </HardDisks>

and in

    <AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
      <Image uuid="{5d34479f-5597-4b78-a1fa-94e200d16bbb}"/>
    </AttachedDevice>

It worked for me for VirtualBox ver. 5.1.8 running on Mac OS X El Capitan.

answered Dec 15, 2016 at 23:09

Oleg Gryb's user avatar

Oleg GrybOleg Gryb

5,0741 gold badge27 silver badges40 bronze badges

4

I have searched the web for an answer regarding MAC OS, so .. the solution is

cd /Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/

VBoxManage internalcommands sethduuid "full/path/to/vdi"

answered Apr 14, 2017 at 17:40

al3x2ndru's user avatar

al3x2ndrual3x2ndru

5885 silver badges8 bronze badges

0

Though you have solved the problem, I just post the reason here for some others with the similar problem.

The reason is there’s an space in your path(directory name VirtualBox VMs) which will separate the command. So the error appears.

answered Aug 27, 2013 at 1:36

JavaNoScript's user avatar

JavaNoScriptJavaNoScript

2,32521 silver badges27 bronze badges

The command fails because it has space in one of the folder name,
i.e. ‘VirtualBox VMs.

VBoxManage internalcommands sethduuid /home/user/VirtualBox VMs/drupal/drupal.vhd

If there is no space at folder name or file name, then the command will work even without quoting it,
e.g. after changing ‘VirtualBox VMs’ into ‘VBoxVMs’

VBoxManage internalcommands sethduuid /home/user/VBoxVMs/drupal/drupal.vhd

answered Feb 20, 2014 at 11:56

januarvs's user avatar

januarvsjanuarvs

3983 silver badges7 bronze badges

Same solution as @Al3x for Windows x64, in cmd.exe:

cd %programfiles%OracleVirtualBox

VBoxManage internalcommands sethduuid "full/path/to/.vdi"

This randomizes the UUID of the disk. Pro tip: Right click the .vdi file while holding shift and select «Copy as path» to obtain "full/path/to/.vdi" and enable quick edit in cmd.exe, then right click to paste.

answered Nov 14, 2018 at 9:03

masterxilo's user avatar

masterxilomasterxilo

2,3741 gold badge29 silver badges34 bronze badges

Even though this question asked is old, note that changing a UUID on a virtual HDD in a windows system will make windows treat it as a not activated machine (as it notices the disk change) and will ask for reactivation !

answered Jul 2, 2015 at 10:28

aniston's user avatar

anistonaniston

2,9872 gold badges10 silver badges3 bronze badges

Another alternative to your original solution would be to use the escape character before the space:

VBoxManage internalcommands sethduuid /home/user/VirtualBox VMs/drupal/drupal.vhd

answered Sep 9, 2015 at 0:21

Whitaker's user avatar

Did you try to copy, move or back up and restore your VirtualBox virtual machines and now one or more of them cannot boot because of “some UUID problem?” Here we will show you how you can change the UUID in VirtualBox HHDs.

When we set up a Virtual Machine in VirtualBox, it’s given a Universal Unique IDentifier, or UUID for short. This is a 128-bit number, specific to the virtual hardware. Here’s the thing: the Hard Disk Drives attached to the VMs we make also have their own UUIDs. Those are also presumed to be unique. When they are not, problems emerge.

Change Virtualbox Uuid Virtualbox Hdd Uuid Error

The most usual case may appear after you try to copy or back up a virtual machine. When trying to run “a second version” of the VM, VirtualBox might announce that its HDD’s UUID isn’t the one it was waiting on.

That’s when you should reset the HDD’s UUID and reattach it to the VM as a new device. It is easy to do but demands the use of a command-line tool, coupled with some clicks in a rarely visited part of VirtualBox’s GUI.

Meet VboxManage

VirtualBox comes with a command-line tool, VboxManage, that, as its name states, helps you manage your virtual machines.

VboxManage is the Swiss Army knife of VirtualBox. It is the command-line interface to the program, offering a lot of functionality not encountered in the “main” GUI-based app.

With it, you can create new virtual machines, modify their parameters, clone them, or reset a virtual HDD’s UUID. And that last one is precisely what we require here.

Change Virtualbox Uuid Vboxmanage

If you have VirtualBox, VboxManage is already installed. To check it out, enter in a terminal:

Two commands worth remembering

Although we won’t need them for this article, two VboxManage commands worth remembering when troubleshooting VMs are:

vboxmanage showhdinfo FILE
Change Virtualbox Uuid Vboxmanage List Vms

The first one displays a list of all your virtual machines that are “attached” to VirtualBox.

The second one can show information about the virtual hard disk files you feed it.

Although the process we will employ is uncomplicated and bulletproof, you can use the second one on your virtual hard disk file before and after the procedure. This way, you’ll be sure its UUID has changed.

Release the HDD

From VirtualBox’s main window, with your VM stopped, select “File -> Virtual Media Manager.”

Change Virtualbox Uuid Virtualbox Virtual Media Manager

From the window that appears on your screen, identify your problematic hard disk drive. Click on it to select it. Then, click on the “Release” button to detach the selected HDD from VirtualBox. Confirm that you want to release it when VirtualBox asks you if you are sure. Then click on “Remove.”

Change Virtualbox Uuid Virtualbox Virtual Media Manager Window

VirtualBox will notify you that “As this hard disk is inaccessible, its image file can not be deleted.” Click on “Remove.” If the error message is different, skip this step to avoid really deleting your virtual hard disk.

Go back to your terminal and enter:

vboxmanage internalcommands sethduuid FILENAME

Replace “FILENAME” with your actual virtual hard disk file.

Change Virtualbox Uuid Vboxmanage Sethduuid

The program should notify you of the new UUID assigned to the virtual hard disk file.

Re-attach your virtual HDD

Return to the Virtual Media Manager window and click on “Add.” Find and select the updated virtual hard disk file to connect it again to VirtualBox.

Change Virtualbox Uuid Virtualbox Select Updated Hdd File

Close the Virtual Media Manager window and revisit the settings of the virtual machine that was affected by the problem.

Move to the “Storage” settings of your virtual machine and pick the appropriate controller. Click on the icon with the HDD and the plus sign. Select “Choose existing disk” and then, from the window that pops up, your updated virtual hard disk file.

Change Virtualbox Uuid Virtualbox Reattach Updated Hdd File

Click OK to save the changes and exit the window. Start your virtual machine and, if everything went according to plan, it should boot with no problems.

Related:

  • How to Install Guest Additions in VirtualBox
  • How to Import and Export OVA Files in Virtualbox
  • How to Shrink a Virtualbox VM in Windows 10

Odysseas Kourafalos

Odysseas Kourafalos

OK’s real life started at around 10, when he got his first computer — a Commodore 128. Since then, he’s been melting keycaps by typing 24/7, trying to spread The Word Of Tech to anyone interested enough to listen. Or, rather, read.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Hello Everyone,

Today we will look at how to change or keep UUID of the Virtual Machine in the VMware world.

I recently came across an issue when a user had lost access to an entire LUN and the datastore was unmounted in vSphere.

On further investigation, we found that the storage array was not supported by VMware and requested the user to check if there was a way that he could restore the  LUN data on a supported array.

Finally, after restoring the data the next step was present the LUN and create datastore out of it, which we did and we could see the Virtual Machine files.

First, we had to remove the old VMs from inventory as we had identical VMs now available on a new datastore and were ready to be added to the inventory.

Enough of the background, now let me get to the actual topic of changing or keeping the UUID of the Virtual Machine.

Each virtual machine is automatically assigned a universally unique identifier (UUID), which is stored in the SMBIOS system information descriptor.

The UUID is a 128-bit integer. The 16 bytes of this value are separated by spaces, except for a dash between the eighth and ninth hexadecimal pairs. A sample UUID looks like this:

56 4d ef 2d 3f d4 14 e2-2e 04 c5 34 3a ec ee 65

This UUID is generated when you power ON or reset the Virtual Machine. As long as the VM is not copied or moved to another location, this UUID does not change.

Now, in our case, we did not move the VM files to a new LUN and created a datastore on it, so the UUID would change.

The task was to keep the UUID the same as there was a backup application that was dependent on the UUIDs of the VMs.

Backup tools like Veeam and others make use of the UUID of the VM to uniquely identify the objects within inventory.

As mentioned before, when we tried to power ON the VM, we were presented with question as seen below:

Question (id = 0) : msg.uuid.altered:This virtual machine might have been moved or copied.
In order to configure certain management and networking features, VMware ESX needs to know if this virtual machine was moved or copied.

If you don’t know, answer «I copied it».

  • Cancel

  • I moved it

  • I copied it

How to change or keep UUID of the Virtual Machine

If you choose to keep to the UUID of the Virtual machine, you need to select the second option (I moved it) to keep the UUID of the VM.

If you wish to change/create a new UUID for the VM, select the third option (I copied it) and power ON the VM.

We could also perform this step by editing the vmx file of the VM before powering on the VM and adding the line below to either change or keep UUID of the Virtual Machine.

Open the vmx file of the VM using the vi editor and add the below line to change the UUID.

uuid.action = «create»

To keep the UUID, add the below line.

uuid.action = «keep»

I hope this has been informative and thank you for reading!

About Author

I am Adil Arif, working as a Senior Technical Support Engineer at Rubrik as well as an independent blogger and founder of Enterprise Daddy. In my current role, I am supporting infrastructure related to Windows and VMware datacenters.

I’d like to change the hard disk’s serial number in VirtualBox.

Does anyone know how to do that?

slhck's user avatar

slhck

219k68 gold badges592 silver badges580 bronze badges

asked Nov 8, 2012 at 8:35

asker's user avatar

2

I’m guessing you want to change the UUID of the hard disk
uuid is like this UUID {55b773b8-cbcb-42ea-9a44-1368b30ed823}

To set the UUID of a hard drive run this in command prompt :

VBoxManage internalcommands setvdiuuid disk2.vdi

eg: VBoxManage internalcommands sethduuid disk2.vdi 55b773b8-cbcb-42ea-9a44-1368b30ed823 will work.

Journeyman Geek's user avatar

answered Nov 9, 2012 at 12:02

swapyonubuntu's user avatar

1

Looks like the command has changed:

sethduuid <filepath> [<uuid>]
    Assigns a new UUID to the given image file. This way, multiple copies
    of a container can be registered.

So in my case it was:

C:Program FilesOracleVirtualBox>VBoxManage internalcommands sethduuid <vmdk location>

uuid is changed if you don’t fill in a new one either way.

slhck's user avatar

slhck

219k68 gold badges592 silver badges580 bronze badges

answered Jul 19, 2013 at 8:49

user239204's user avatar

I guess you mean the Volume Serial Number that you see when you do a dir in de command console.

VolumeID solved it for me, run it as administrator:

volumeid C: C8BA-7B18

After the reboot it’d be changed:

C:>dir
 Volume in drive C has no label.
 Volume Serial Number is C8BA-7B18

 Directory of C:
 ...

Xandy's user avatar

Xandy

3,47022 silver badges28 bronze badges

answered Nov 9, 2012 at 9:58

Nikske's user avatar

I’d like to change the hard disk’s serial number in VirtualBox.

Does anyone know how to do that?

slhck's user avatar

slhck

219k68 gold badges592 silver badges580 bronze badges

asked Nov 8, 2012 at 8:35

asker's user avatar

2

I’m guessing you want to change the UUID of the hard disk
uuid is like this UUID {55b773b8-cbcb-42ea-9a44-1368b30ed823}

To set the UUID of a hard drive run this in command prompt :

VBoxManage internalcommands setvdiuuid disk2.vdi

eg: VBoxManage internalcommands sethduuid disk2.vdi 55b773b8-cbcb-42ea-9a44-1368b30ed823 will work.

Journeyman Geek's user avatar

answered Nov 9, 2012 at 12:02

swapyonubuntu's user avatar

1

Looks like the command has changed:

sethduuid <filepath> [<uuid>]
    Assigns a new UUID to the given image file. This way, multiple copies
    of a container can be registered.

So in my case it was:

C:Program FilesOracleVirtualBox>VBoxManage internalcommands sethduuid <vmdk location>

uuid is changed if you don’t fill in a new one either way.

slhck's user avatar

slhck

219k68 gold badges592 silver badges580 bronze badges

answered Jul 19, 2013 at 8:49

user239204's user avatar

I guess you mean the Volume Serial Number that you see when you do a dir in de command console.

VolumeID solved it for me, run it as administrator:

volumeid C: C8BA-7B18

After the reboot it’d be changed:

C:>dir
 Volume in drive C has no label.
 Volume Serial Number is C8BA-7B18

 Directory of C:
 ...

Xandy's user avatar

Xandy

3,47022 silver badges28 bronze badges

answered Nov 9, 2012 at 9:58

Nikske's user avatar

На английском языке ошибка звучит так:

Cannot register the hard disk because a hard disk with UUID ... already exists.

vbox-move-hdd-0005

Данная ошибка возникает при попытке добавить файл виртуального жёсткого диска к виртуальной машине после перемещения этого файла.

Зачем перемещать файл виртуального жёсткого диска

Это бывает необходимо, если на текущем жёстком диске компьютера недостаточно свободного места. Либо в случае, если вы хотите переместить файл на более быстрый накопитель компьютера (например SSD) для улучшения быстродействия виртуальной машины.

Перемещение файла виртуального жёсткого диска

1.Поиск файла и собственно перемещение

Откройте менеджер виртуальных машин. Выберите нужную виртуальную машину и вызовите её свойства (Настроить):

vbox-move-hdd-0011

На вкладке Носители выясните путь к файлу виртуального жёсткого диска и скопируйте его:

vbox-move-hdd-0012

Вставьте в адресную строку путь, сотрите имя файла в конце и нажмите Enter. Вы попадёте в папку, где расположен файл.

Переместите файл, куда желаете. Мы в нашем примере перемещаем с диска E на диск C SSD.

vbox-move-hdd-0015

2. Изменение UUID виртуального жёсткого диска в Virtualbox

Выполните следующие действия:

1. Запустите командную строку:

vbox-move-hdd-0021

2. Откройте папку, где установлена Virtualbox.

3. В командной строке наберите cd и поставьте один пробел.

4. Перетащите иконку папки в командную строку. Должна получиться строка:

cd "C:Program FilesOracleVirtualbox"

5. Нажмите Enter:

vbox-move-hdd-0025

6. Наберите команду vboxmanage internalcommands sethduuid и поставьте один пробел.

7. Перетащите файл жёсткого диска в командную строку. Должна получиться строка вида:

vboxmanage internalcommands sethduuid C:folderwin7.vdi

8. Нажмите Enter: 

vbox-move-hdd-0026

Вот так выглядит окно консоли после выполнения всех команд:

vbox-move-hdd-0027

Если вы видите сообщение

UUID changed to:...

значит, всё получилось.

Если при попытке изменить  UUID вы получили ошибку Syntax error: Invalid UUID parameter, возьмите путь в кавычки следующим образом:

vboxmanage internalcommands sethduuid "E:VirtualBox VMswin8win8.vdi"

Чаще всего эта ошибка возникает из-за того, что в имени какой-то папки в пути есть пробелы.

3. Подключение перемещённого файла к виртуальной машине

Откройте свойства виртуальной машины и перейдите на вкладку Носители.

Удалите жёсткий диск:

vbox-move-hdd-0028

Добавьте жёсткий диск, указав новое расположение перемещённого файла виртуального жёсткого диска:

vbox-move-hdd-0029

Выбрать существующий образ

Нажмите ОК для сохранения изменений виртуальной машины:

Сохранение свойств виртуальной машины

Как видите, теперь ошибки не наблюдается.

Понравилась статья? Поделить с друзьями:
  • Как изменить uuid virtualbox
  • Как изменить userprofile windows 10
  • Как изменить username twitter
  • Как изменить username spotify
  • Как изменить username github