NVMe

Last change on 2021-04-16 • Created on 2020-03-20 • ID: RO-C1DC0

Introduction

NVMe (Non-Volatile Memory Express) is a specification for accessing drives via PCI Express; it is specifically tailored to the needs of non-volatile memory. The connection via PCIe Gen3 x4 (32 GBit/s) offers, for example, up to five times faster access speeds and lower latencies than conventional SATA 3 (6GBit/s) interfaces. Thanks to a high degree of parallelism and low energy consumption, they let users meet current and future memory requirements.

Characteristics

NVMe SSDs are addressed differently than SATA drives. In a UNIX system (Linux/BSD), the first NVMe-SSD is called /dev/nvme0n1 instead of /dev/sda. The n after nvme0 stands for "Namespace". The first partition on this SSD is /dev/nvme0n1p1 instead of /dev/sda1.

The scheme is:

/dev/nvme<CONTROLLER_NUMBER>n<NAMESPACE>p<PARTITION>

NVMe-CLI

To manage NVMe SSDs, you can use the nvme-cli tool on UNIX systems.

In the Hetzner Rescue System, this tool is already pre-installed.

Show list of all detected NVMe SSDs

nvme list
Node             SN                   Model                                    Version  Namespace Usage                      Format           FW Rev
---------------- -------------------- ---------------------------------------- -------- --------- -------------------------- ---------------- --------
/dev/nvme0n1     S1XXNYAGAXXXXX       SAMSUNG MZVPV512HDGL-00000               1.1      1         102.40  GB / 512.11  GB    512   B +  0 B   BXW7300Q
/dev/nvme1n1     S1XXNYAGAYYYYY       SAMSUNG MZVPV512HDGL-00000               1.1      1         102.40  GB / 512.11  GB    512   B +  0 B   BXW7300Q

Show serial number of a specific NVMe SSD

nvme id-ctrl /dev/nvme0n1|egrep "sn |mn "
sn      : S1XXNYAGAXXXXX
mn      : SAMSUNG MZVPV512HDGL-00000

Show the SMART log

SMART stands for Self-Monitoring, Analysis and Reporting Technology. Some NVMe SSD models support the SMART log read out using the tool smartctl. It is also used for SATA drives and might provide more details for you than if you used the nvme tool.

Using Smartctl

smartctl -a /dev/nvme0n1
smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.19.101] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
[...]
=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02, NSID 0x1)
Critical Warning:                   0x00
Temperature:                        29 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    0%
Data Units Read:                    113,446 [58.0 GB]
Data Units Written:                 48,760 [24.9 GB]
Host Read Commands:                 111,504,973
Host Write Commands:                41,507,430
Controller Busy Time:               1,395
Power Cycles:                       7
Power On Hours:                     395
Unsafe Shutdowns:                   0
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               29 Celsius
Temperature Sensor 2:               30 Celsius

Error Information (NVMe Log 0x01, max 64 entries)
No Errors Logged

Using NVMe-CLI

nvme smart-log /dev/nvme0n1
Smart Log for NVME device:nvme0n1 namespace-id:ffffffff
critical_warning                    : 0
temperature                         : 29 C
available_spare                     : 100%
available_spare_threshold           : 10%
percentage_used                     : 0%
data_units_read                     : 113,446
data_units_written                  : 48,760
host_read_commands                  : 111,504,973
host_write_commands                 : 41,507,430
controller_busy_time                : 1,395
power_cycles                        : 7
power_on_hours                      : 395
unsafe_shutdowns                    : 0
media_errors                        : 0
num_err_log_entries                 : 0
Warning Temperature Time            : 0
Critical Composite Temperature Time : 0
Temperature Sensor 1                : 29 C
Temperature Sensor 2                : 30 C

Show the error log

nvme error-log /dev/nvme0n1
Error Log Entries for device:nvme0n1 entries:1
.................
 Entry[ 0]
.................
error_count  : 0
sqid         : 0
cmdid        : 0
status_field : 0(SUCCESS: The command completed successfully)
parm_err_loc : 0
lba          : 0
nsid         : 0
vs           : 0
cs           : 0
.................

Perform a self test

You can start a short self test (duration: up to 1h) for checking the NVMe SSDs health using the following command:

nvme device-self-test /dev/nvme0n1 -s 1

Once the self test has been started, you can use this command to check the current state:

nvme self-test-log /dev/nvme0n1
  • Output, while the test is running:

    Test is 21% complete and is still in progress.
  • If the output of the named command states 0%, the test is either not running, or not supported by the installed NVMe SSD:

    Test is 0% complete and is still in progress.
  • Once the test has been finished, please re-check the SMART health data (see the regarding section in this article).

Table of Contents