NVMe by Gentoo

What is NVMe short for?
NVMe is short for NVM Express.

What does NVM stand for? (1)
NVM stands for Non-Volatile Memory.

What are NVMe devices?
NVMe devices are flash memory chips connected to a system through the PCI-E bus.

Installation

What kernel option needs to be activated in order for NVMe devices to be supported?
The kernel option that needs to be activated in order for NVMe devices to be supported is NVM Express block device or CONFIG_BLK_DEV_NVME.

How will NVMe devices show up under /dev?
NVMe devices will show up under /dev as `/dev/nvme`.*

Todo

This section includes the default kernel settings for NVMe devices on other GNU / Linux distributions.

Emerge

What package includes user space tools for NVMe devices?
The package that includes user space tools for NVMe devices is sys-apps/nvme-cli.

Identifying the device

What do NVMe partitions show before the partition number?
Before the partition number, NVMe partitions show the letter p.

What do NVMe devices also support aside from partitions?
Aside from partitions, NVMe devices also support namespaces.

What do NVMe namespaces show before the namespace number?
Before the namespace number, NVMe namespaces show the letter n.

Example of how the first partition in the first namespace of the first NVMe device will appear in /dev
/dev/nvme0n1p1

Usage

What program can be used to get the raw read / write speed of an NVMe device?
The program that can be used to get the raw read / write speed of an NVMe device is hdparam.

What are the three options you pass to hdparam to test the raw read / write speed of an NVMe device and what do they instruct hdparam to do?
The three options you pass to hdparam to test the raw read / write speed of an NVMe device and what they instruct hdparam to do are:

  1. -t - Perform timings of device reads.
  2. -T - Perform timings of cache reads.
  3. --direct - Bypass the page cache and cause reads to go directly from the drive into hdparam's buffers in raw mode.
Example of testing the raw read / write speed of /dev/nvme0n1
hdparam -tT --direct /dev/nvme0n1

Performance and maintenance

Since NVMe devices share the flash memory technology basis with common SSDs, the same ... and ... ... apply.
Since NVMe devices share the flash memory technology basis with common SSDs, the same performance and longevity considerations apply.

Kernel I/O scheduler

What kernel I/O scheduling strategy should you use with NVMe devices and why?
With NVMe devices, the kernel I/O scheduling strategy you should use is the simplest strategy available because of their really high read speed.

What is the name of the simplest kernel I/O scheduling strategy on recent kernels?
On recent kernels, the name of the simplest kernel I/O scheduling strategy is none.

How do you get the name of the current kernel I/O scheduling strategy?
To get the name of the current kernel I/O scheduling strategy, you can use cat to read the scheduler file from the sysfs.

Example of reading the scheduler file from the sysfs for nvme0n1
$ cat /sys/block/nvme0n1/queue/scheduler
none

What are the two ways you can change the scheduler for a device?
The two ways you can change the scheduler for a device are:

  1. Writing the name of the desired scheduler to the sysfs scheduler file.
  2. Creating udev rules in /etc/udev/rules.d.
Example of changing the scheduler for nvme0n1 by writing to the sysfs scheduler file

echo "none" > /sys/block/nvme0n1/queue/scheduler

Example of changing the scheduler for nvme0n1 by creating udev rules in the file /etc/udev/rules.d/60-ioschedulers.rules
# Set scheduler for NVMe devices
ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="none"