48

Recently I installed an NVMe drive in my Linux computer and I noticed that it's listed as /dev/nvme0 and its partition is /dev/nvme0p1. I'm aware that it's a different interface than SATA drives, but what's the reason why it's listed this way? It seems like calling drives /dev/sd$LETTER$PARTITIONNUMBER is the standard, even when things have different standards like SCSI, and this breaks that by using numbers instead of letters to denote the drive and a p before the partition number, in addition to the different name.

  • 4
    What do you suppose "sd" stands for? – user20574 Jun 18 at 1:54
  • 35
    @user20574 it stands for "South Dakota", as we all know hard drives were originally discovered at the base of the Big Sioux River. – user1030296 Jun 18 at 4:43
64

/dev/sd was originally used for devices using the sd-bus driver, which is the driver for SCSI devices (and sd literally stands for SCSI disk). Nowadays it is used for SCSI disks, SATA disks, and USB disks. The reason seems to be that now almost all devices use the SCSI command protocol on top of non-SCSI bus (the kernel treats all ATA-devices equally using libata and it pretends they're SCSI devices - credit to @grawity), and therefore we see all of these devices as /dev/sd.

But not all storage devices are /dev/sd. /dev/hd and /dev/xvd are still used - the former for PATA/IDE disks and the latter for cloud storage devices (virtual disks and etc.) and they all have different drivers and naming. You don't see them because virtual storage is only on clouds / hypervisors (and you probably don't use any) and because PATA/IDE disks are becoming more and more rare and on most modern machines the kernel actually uses ide-scsi driver to translate it to SCSI protocol (credit to @Wumpus Q. Wumbley).

Other examples include /dev/mmcblkXpY which is for SD/eMMC/bare NAND/NOR devices and has the same naming scheme as /dev/nvme and /dev/vd which is again used for virtual disks in cloud storage (credit to @Jan Dorniak for the extra examples).


In your case, it is called /dev/nvme because the disk is connected through an NVME port and uses the nvme driver on Linux. You can just think of /dev/<something> as a device that uses <something> driver. All device drivers and namings have their own standards, it's not one standard for all of them, so it's completely okay if the naming for NVME devices is like that. And the reason why nvme isn't translated to scsi as well is that the two protocols are too different and such an implementation would be too complex (refer to the comments by @grawity and @Vality for more detailed info).

5

In addition to the other answer, note that NVMe has the concept of namespaces that would not fit in the /dev/sd<letter(s)><number> pattern. For example, on my system:

$ ls -1 /dev/nvme*
/dev/nvme0
/dev/nvme0n1
/dev/nvme0n1p1
/dev/nvme0n1p2
  • You mean to say that there exist NVME devices with internal configuration such that N can be a number other than 1. So /dev/nvme1n3 for example which would then have partitions on it, so nvme1n3p5 and this can't be expressed as /dev/sdb5 (where's the n3?) – Criggie Jun 18 at 1:11
  • 2
    @Criggie It is indeed possible, it's just really rare to find setups like that. That said, while it could be represented as another disk, that adds other issues that are more complicated to solve (namely, mapping those disks back to actual NVMe devices, and the fact that some NVMe devices can reconfigure namespaces online). – Austin Hemmelgarn Jun 19 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy