Page 1 of 1
VBoxManage internalcommands createrawvmdk using UUID
Posted: 11. Oct 2020, 02:24
by didierg
Hi all,
I attach a physical disk to a virtual machine using /dev/sdx in the VBoxManage internalcommands createrawvmdk command.
It works fine but depending of the number of disks connected to the bar metal machine device name changes.
Is there a way to use not /dev/sdx but UUID of the physical disk to avoid this problem ?
Thanks for your help.
Re: VBoxManage internalcommands createrawvmdk using UUID
Posted: 11. Oct 2020, 10:16
by mpack
Physical disks don't have virtual disk UUIDs. The UUID in question is a field in the virtual disk header, which of course is lacking in a raw image. Some filesystems may store UUIDs on the disk for other purposes, but those purposes are nothing to do with any VM platform.
It's possible to assign any UUID you like to a VDI, there's an internalcommand for that (VBoxManage internalcommands sethduuid <file> <uuid>). You'd have to take care: different tools have different byte order conventions (presentation and storage) for UUIDs.
Re: VBoxManage internalcommands createrawvmdk using UUID
Posted: 11. Oct 2020, 11:16
by fth0
didierg wrote:Is there a way to use not /dev/sdx but UUID of the physical disk to avoid this problem ?
I haven't tried it myself inside VirtualBox, but I'd suggest to try the symbolic links in the
/dev/disk/by-* hierarchy. At least they were invented exactly to solve the Linux device enumeration and naming problem that you're experiencing.
Please report back if it works or not.
Re: VBoxManage internalcommands createrawvmdk using UUID
Posted: 11. Oct 2020, 12:56
by didierg
fth0 wrote:I haven't tried it myself inside VirtualBox, but I'd suggest to try the symbolic links in the /dev/disk/by-* hierarchy. At least they were invented exactly to solve the Linux device enumeration and naming problem that you're experiencing. )
@ fth0
I edited the vmdk file and I modified the line to specify the disk by UUID and it works !
The line in vmdk now looks like that:
Code: Select all
# Extent description
# RW 488397168 FLAT "/dev/sdd" 0
RW 488397168 FLAT "/dev/disk/by-id/ata-Samsung_SSD_840_EVO_250GB_S1DBNSAF123456F" 0
Thanks for your help.