Why is there both character device and block device for nvme?
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.