Why does Linux list NVMe drives as /dev/nvme0 instead of /dev/sda?
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.
/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).
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