Suggestions for working with unstable nvme dev names in AWS

George Hartzell hartzell at alerce.com
Fri May 17 03:12:38 UTC 2019


[resending this, I dropped freebsd-questions when I sent it originally]

Matthew Seaman writes:
 > On 15/05/2019 04:06, Matthew Seaman wrote:
 > > This is a pretty difficult problem.  Unless AWS can supply some sort of
 > > identification of the device beyond the /dev/nvme1 device specials or
 > > else somehow guarantee ordering so the device names are consistent
 > > across multiple EC2 instances then about your only possible choice is to
 > > develop some heuristics like "if the device is 300MB in size then it's
 > > the special high-IOPS device I want to use for my separate zlog."
 > 
 > I have it on good authority that you should be able to extract the
 > Volume ID 'vol-9999999999' from the output of nvmecontrol -- however I
 > don't know much beyond that, and I don't have any readily accessible
 > hardware to test against.  Knowing the volume ID I believe should be
 > sufficient for you to be able to set a meaningful glabel on the drive
 > partitions (or however you want to do it).

The volume id is encoded in the "serial number" output of `nvmecontrol
identify`.  It might be possible to walk that back, but it's not clear
I'd do it in Terraform (my "set up AWS stuff" tool of choice).  Having
the device show up with the name you "asked" for makes it a no
brainer.

`nvmecontrol` is perfectly poised to fetch the information that
actually solves the problem directly (it's further down in vendor
specific section of the struct that's passed back from the driver from
the ioctl that `identify` uses).

So, I've gone ahead and put together a patch[1] that returns the
necessary info.  I've asked Colin Percival for feedback.

It'll let me put together the `devd` equivalent of these `udev` rules
[2] (you can see how the linux folks use their ebsnvme-id)and away
I'll go.

g.

[1]: https://github.com/hartzell/freebsd/commit/4b2204e6882cedc3452f278b4e49139f81a690c9
[2]: https://gist.github.com/hartzell/25f56a634730a41a5f092967f057a841#file-udev-L24-L25



More information about the freebsd-questions mailing list