Why is there both character device and block device for nvme?

9,808

Solution 1

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.

Solution 2

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.

Share:
9,808

Related videos on Youtube

GP92
Author by

GP92

Updated on September 18, 2022

Comments

  • GP92
    GP92 almost 2 years

    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
    GP92 over 6 years
    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?
  • John Mahowald
    John Mahowald over 6 years
    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.