Nvme drive changing number

Being somewhat of a newbe to linux and in general not the sharpest knife in the drawer, I want to take time out and thank everyone that has patiently help me finally understand simlinks and how then can be used to represent storage devices to virtualbox.
So a big THANK YOU to all of the folks above for your help!!!

1 Like

Another quick stab at this…

A whole-disk UUID (Disk identifier) is assigned when a GPT partition table is written. You don’t need to know much more than that; only, how to find what it is; and this is how:

sudo fdisk -l /dev/nvme0n1

The output will be something like:

# fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: XXX.X GiB, XXXXXXXXXXXX bytes, XXXXXXXXX sectors
Disk model: The NVMe Model
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

This Disk Identifier on the last line will be the Disk UUID.

Now, you should be able then to access it using one of the following notations (or, so the theory goes):

  • RawDisk=/dev/disk/by-ptuuid/xxxx
  • RawDisk=/dev/disk/by-uuid/xxxx
  • RawDisk=/dev/disk/by-id/xxxx

Individual partition(s) should be accessible via the Partitions= parameter.
If not… :man_shrugging:

Cheers.

2 Likes

I figured out all that you explained, but via experimentation discoved that only “by-id” seems to allow the “partitions” parameter. But that is enough for me to create “RawDrive=” parms and specify Partitions, so I’ve made the request changes and no longer have issues when the M.2 devices switch numbers. IE Vbox finds the correct volumes to boot no matter what the nvmexxxx number is.

As it should, because it references the UUID’s internally, regardless.

All that remains is for you to assign a post in the thread as the solution, and it should be closed automatically, sometime thereafter.

Cheers.

1 Like

I agree this one should be closed as by-id works. but even using the uuid garnered from the “sudo fdisk -l /dev/nvme0n1” doesn’t seem to work as it can’t find the device with that uuid. I can share the error info, but it’s a bit messy, and not sure it’s worth picking through from your side. Let me know and I can post here. the m.2 devices are reversed so I will be working with nvme1n1 rather then 0n1.

1 Like

Idealy that should be the PTUUID, but I couldn’t find anything to confirm that Virtualbox supported referencing that; only the ID, as you found. I’d tend to agree with your earlier comment; especially after all the effort; just go with what is actually known to work.

1 Like

That’s logic. A partition has no partitions.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.