Suggestions for working with unstable nvme dev names in AWS

George Hartzell hartzell at alerce.com
Wed May 15 15:40:25 UTC 2019


Matthew Seaman writes:
 > On 14/05/2019 22:01, George Hartzell wrote:
 > > But when I boot, I find that I have two devices (in addition to the
 > > root device), `/dev/nvme1` and `/dev/nvme2`.  There's no way to know
 > > which is the big-slow one that I wanted to call `/dev/sdh` and which
 > > is the small-fast `/dev/sdz`.  In fact, if I reboot the machine,
 > > sometimes the big-slow one will be `/dev/nvme1` and sometimes it will
 > > be `/dev/nvme2`.
 > > 
 > > Given that situation, how do you write an automated script that will
 > > label the big-slow one `backups` and the small-fast one `speedy`?
 > 
 > This is a pretty difficult problem.  Unless AWS can supply some sort of
 > identification of the device [...]

*BINGO*.  AWS stores the device names that you requested when you
created the device somewhere inside it.  It's available via an ioctl
(I believe) in the Linux kernel and is easily accessed via a python
script named `ebsnvme-id` [2].  AWS has documented it all here [1], in
the "Identifying the EBS Device" section.

So, when the system boots, it uses a udev rule (like our devd) to run
the script and make the symlinks that make everything else straight
forward.

I can't figure out how to get at the info via `nvmcontrol` or
`camcontrol` and the linux script doesn't work as is (which is not
surprising).

I suspect that our nvme/nvd driver would need to have support added
for this, but was/am hopeful it's already a solved problem.

g.

[1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html
[2]: https://gist.github.com/lbernail/d851e5b06eb32180a4b8ead2ce4f45db


More information about the freebsd-questions mailing list