7

The Linux kernel's simple naming for a storage device (e.g. /dev/sda, /dev/sdb) can change randomly across boots. Is that true for NVMe storage devices too? These have names such as /dev/nvme0n1p1 and /dev/nvme0n1p2, etc.

5
  • 1
    And those still generate the usual persistent names in by-uuid, etc., AFAICT. So why not use them? Commented Jun 27, 2018 at 0:07
  • @muru - There are situations in which persistent names using by-uuid, by-id and by-path and not necessarily appropriate. Sometimes labels might be preferred., for example However, as far as I am concerned that discussion is off topic. I'm trying to keep this question simple and focused. In this question I want to know whether the NVMe names are subject to the same limitations as regular sdX names. Commented Jun 27, 2018 at 1:20
  • 1
    off-topic? Persistent device names in this context usually mean those in the various by-*, and that's what's in the title. Commented Jun 27, 2018 at 1:22
  • To clarify, I wish to know the rules for NVMe device names, especially those names such as /dev/nvme0n1p1 or /dev/nvme0n1p2. My specific question is whether there is any persistence inherent in those names. But it might help me to know more about NVMe naming and under which circumstances NVMe devices names might change. I have not been able to find much except that the old rules don't apply to NVMe devices. Commented Jun 27, 2018 at 1:41
  • 1
    Then I suggest changing the title, since "persistent device name" has a specific meaning in this context and you're not using it. Commented Jun 27, 2018 at 1:42

1 Answer 1

11

Short: No. You can not rely on the name of the descriptor. And you most likely never will.

The NVMe naming standard describes:

  • nvme0: first registered device's device controller
  • nvme0n1: first registered device's first namespace
  • nvme0n1p1: first registered device's first namespace's first partition

So the overall naming is depended on your physical layout. And that can change depending on you use case by adding/removing block devices, drive failures, etc.

Basically the same as with the sd_ descriptors.

What you can rely on is the order of the listed partitions for each device, as those are getting stored on and read from the block device' partition table. As long as you do not change the partition layout, the order stays the same.

In the end, referring to either to the device UUID or PARTUUID is still the best practise, even with NVMe. Depending on the use case, referring to the LABEL might be more convenient.

1
  • 1
    This answer can be improved by linking to the NVMe Naming Standard. Commented Oct 26, 2019 at 8:31

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.