Virtualbox HardDisk uuid - what is it in Windows guest?

Discussion in 'Virtualization' started by sebus, Dec 17, 2017.

  1. sebus

    sebus MDL Guru

    Jul 23, 2008
    5,895
    1,783
    180
    #1 sebus, Dec 17, 2017
    Last edited: Dec 17, 2017
  2. sebus

    sebus MDL Guru

    Jul 23, 2008
    5,895
    1,783
    180
    In this post kelorgo
    mentioned:


    which is definitely NOT what I am seeing
    No matter what HardDisk uuid=, the resulting serialnumber is identical in same VM
     
  3. sebus

    sebus MDL Guru

    Jul 23, 2008
    5,895
    1,783
    180
    #3 sebus, Dec 19, 2017
    Last edited: Dec 20, 2017
    (OP)
    Anybody?
    That is really bugging me!

    edit:
    This is what actually gives full difference:

    Code:
    wmic path win32_physicalmedia get Tag,SerialNumber
    It is the serial no of the "physical" drive, not the volume that gets created while OS installs (something that is rather "tricky" to change on physical hardware
     
  4. bear_aussie

    bear_aussie MDL Junior Member

    Jun 8, 2015
    56
    28
    0
    i thought the hdd uuids in vbox were for the hypervisors use and didn't surface in the client os?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. sebus

    sebus MDL Guru

    Jul 23, 2008
    5,895
    1,783
    180
    And here you are, just learnt something new...
     
  6. Carlos Detweiller

    Carlos Detweiller MDL Spinning Tortoise

    Dec 21, 2012
    2,364
    1,960
    90
    They can be read out from the guest OS, Hotbird's License Manager does it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. sebus

    sebus MDL Guru

    Jul 23, 2008
    5,895
    1,783
    180
    Thank you, that is absolutely correct, completely forgot about it!

    sebus
     
  8. kelorgo

    kelorgo MDL Addicted

    Oct 29, 2012
    838
    1,499
    30
    #8 kelorgo, Jan 3, 2018
    Last edited: Jan 3, 2018
    The serial number inside a VirtualBox VM is (by default) derived from the hard disk image uuid, but there are a few additional details.

    If you have snapshots, then you have a chain of differencing disk images. The serial number is derived from the very first (parent) hard disk image, not the last image in the chain. You can't easily use "internalcommands sethduuid" on the first image, because the next image in the chain also has a record of the parent's uuid. So "internalcommands sethduuid" is only practical when you have no snapshots.

    When using "wmic diskdrive get serialnumber", Windows 8/8.1/10 displays the serial number differently than Windows 7.
    For example, if the uuid is set to 12345678-0000-0000-0000-000090abcdef:
    In Windows 8+, the serial number is "VB12345678-efcdab90" and is displayed directly as such.
    In Windows 7, the serial number is "BV21436587e-cfad9b 0" and it is displayed with each character encoded in hex. The hex encoding is "42 56 32 31 34 33 36 35 38 37 65 2d 63 66 61 64 39 62 20 30", and you see that without the spaces.

    There is actually a way to set the serial number more directly in VirtualBox, instead of changing the hard disk image uuid. This method overrides the default serial number derived from the uuid.
    To set serial number for a SATA disk:
    Code:
    VBoxManage setextradata "VM name" "VBoxInternal/Devices/ahci/0/Config/Port0/SerialNumber" "VB12345678-90abcdef"
    To set serial number for an IDE disk:
    Code:
    VBoxManage setextradata "VM name" "VBoxInternal/Devices/piix3ide/0/Config/PrimaryMaster/SerialNumber" "VB12345678-90abcdef"
    Note that the extradata settings affect all snapshots of the VM, not just the current one.

    Using "wmic diskdrive get serialnumber", in Windows 8+ you get exactly "VB12345678-90abcdef"
    In Windows 7 you get "BV214365879-a0cbed f" encoded to hex as "42563231343336353837392d6130636265642066"

    P.S.: The above extradata settings, and several more, are documented in the VirtualBox help documentation, in section 9.9.2. under the heading "Configuring the hard disk vendor product data (VPD)"
     
  9. sebus

    sebus MDL Guru

    Jul 23, 2008
    5,895
    1,783
    180
    Correct, thanks for explanation (but by now I personally have it all covered, it only takes few hours of research/reading)
    But very useful if somebody else is interested

    sebus