17

I am trying to understand the configuration of nvme.

But I do not understand why there are two devices: nvme block and nvme character device:

crw------- 1 root root 243, 0 Dec 12 16:09 /dev/nvme0
brw-rw---- 1 root disk 259, 0 Jan 14 01:30 /dev/nvme0n1

What is the purpose of each or when to use them?

GP92
  • 599
  • 2
  • 6
  • 25

2 Answers2

19

The character device /dev/nvme0 is the NVME device controller, and block devices like /dev/nvme0n1 are the NVME storage namespaces: the devices you use for actual storage, which will behave essentially as disks.

In enterprise-grade hardware, there might be support for several namespaces, thin provisioning within namespaces and other features. For now, you could think namespaces as sort of meta-partitions with extra features for enterprise use.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
telcoM
  • 4,153
  • 12
  • 23
  • 1
    Thank you. Where can I read about the concept of namespace in disks. Is it specific to any disk SSD or HDD? or is it specific to just nvme ssd? – GP92 Jan 14 '18 at 12:47
  • 3
    Namespaces are a part of the NVMe specification. The spec is an interface to any "nonvolatile memory subsystem", in practice fast solid state. Practical reading for a sysadmin would be the nvme man page with the admin commands. – John Mahowald Jan 14 '18 at 21:28
4

Think of namespaces as partitions that don't go away when you secure erase the SSD. The controller and namespace(s) are separate. Namespaces can be shared, and can allow remote controllers to access them. Companies like Excelero or Lightbits leverage this technology with their product offerings I believe.

In large devices, say 15TB NVME, you may want to carve the SSD up into 3 separate pieces for different purposes (Cache on /dev/nvme0n1, Database on /dev/nvme0n2, VM storage on /dev/nvme0n3). You could create 3 equal or unequal sized name spaces and use those on each /dev/nvme0n_ device. Any space left over goes to over provisioned capacity which has its own benefits.