Virtual disk descriptor with rawdisk reference using uuid instead of file path

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
Michał
Posts: 2
Joined: 16. Nov 2022, 20:49

Virtual disk descriptor with rawdisk reference using uuid instead of file path

Post by Michał »

Hi. I'm using createrawvmdk command to create a virtual disk decriptor that points to a specific partition of my physical hardware. An example of such command would be as follows

Code: Select all

VBoxManage internalcommands createrawvmdk -filename /Users/me/raw-partition.vmdk -rawdisk /dev/disk1s1
Inside the vmdk file I can see the following line

Code: Select all

# Disk DescriptorFile
version=1
createType="fullDevice"

[...]

# Extent description
RW 976762880 FLAT "/dev/disk1s1" 0
Now the problem is that my host, for whatever reason, doesn't keep the disk ordinal number consistent. Sometimes it's going to b e disk0, upon next reboot disk1 and tomorrow it might be disk5.
In Linux I'd use `/dev/disk/by-uuid` path to point to a specific disk which would solve this issue, however on MacOS there is no such device descriptor in the filesystem. This issue extends to a point where I unplug the disk completely, in such case I'd expect the VM to fail to boot completely instead of randomly selecting a partition.

How can I achieve a consistent reference to a disk and its partition?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Virtual disk descriptor with rawdisk reference using uuid instead of file path

Post by scottgus1 »

This is one of the big problems with Raw Disk Access, which is why it is an experts-only feature that doesn't get "tutorialed" in the forum.

Virtualbox only has the commands in the manual for making raw disk descriptor files. Nothing to determine if the descriptor file points correctly is provided, if I remember correctly. On the other hand, the descriptor file is only a text file, so it can theoretically be created by hand or script before the VM gets started.

I'd look into making a host boot-up script that denotes the disk number of the correct host disk by comparing UUIDs or disk contents etc. then editing the descriptor file so it points correctly.
Michał
Posts: 2
Joined: 16. Nov 2022, 20:49

Re: Virtual disk descriptor with rawdisk reference using uuid instead of file path

Post by Michał »

Ah, well, bummer. I went with pre-boot script approach. clumsy but it'll do. thanks!
Post Reply