mpack wrote:Legorol wrote:If you create a linked clone, the machine UUID does not change.
I never use difference images, but nonetheless I'm reasonably sure that is not correct. The VM UUID certainly changes, therefore I assume the machine UUID changes with it, unless explicitly overridden. AFAIK the only thing which makes a linked clone different than a full clone is that the former uses a difference image as its primary disk.
You are right and I was wrong, I was mixing up machine and hardware UUID for a clone. There is no difference between linked and full clone. I should therefore be more precise and clarify:
VirtualBox has two different UUIDs related to a VM: Machine UUID and Hardware UUID.
VirtualBox assigns each VM a unique UUID, under which it catalogues them, this is the Machine UUID. This is always present in the .vbox file as <Machine uuid="...">. Indeed when you make a new VM or a clone (whether linked or full), a new Machine UUID is always generated.
The Hardware UUID is the value that is passed inside the guest and appears in the guest BIOS as part of the DMI (or more accurately SMBIOS) information. It is the Hardware UUID that is visible to the guest and is taken into account by Windows activation.
By default, the Hardware UUID is not explicitly set and is identical to the Machine UUID. You can change the Hardware UUID via VBoxManage modifyvm "VM name" --hardwareuuid xxx, from which point the Hardware and Machine UUIDs will no longer be equal. The Hardware UUID then shows up in the .vbox file as <Hardware version="X" uuid="...">.
The Machine UUID is a global value for a VM. The Hardware UUID is a per-snapshot value so it is saved and restored with a snapshot just like any other setting (e.g. RAM size).
When you create a clone (full or linked), the Hardware UUID setting also gets copied. If the Hardware UUID wasn't explicitly set before, then it's still not explicitly set. The result is that it matches the Machine UUID, which is different in the clone, so the value inside the guest changes too. However, if the Hardware UUID was set before cloning, then the clone also has the same value and therefore the value inside the guest does not change.
The solution I originally posted is still valid: you clone the VM, then use VBoxManage to set the hardware UUID to match the original VM's machine UUID.
p.s. In case readers are confused - VirtualBox doesn't use VMX files. That would be VMWare. VirtualBox has .vbox files. Do not attempt to make two VBox files have the same VM UUID, it will only result in an error.
Apologies, I meant .vbox files, I corrected my post, thanks for pointing it out.