NVMe-CLI

Aus Thomas-Krenn-Wiki
Zur Navigation springen Zur Suche springen

Das NVMe Command Line Interface (NVMe-CLI) bietet unter Linux und FreeBSD zahlreiche Funktionen zur Abfrage und Konfiguration von NVMe SSDs. In diesem Artikel zeigen wir, wie Sie NVMe-CLI installieren und welche Funktionen NVMe-CLI bietet.

Versionsinformationen

In den Linux Distributionen sind folgende Versionen von NVMe-CLI enthalten:

Linux Distribution NVMe-CLI Version
Debian GNU/Linux 12.0 (Bookworm) nvme-cli 2.3
11.0 (Bullseye) nvme-cli 1.12
10.0 (Buster) nvme-cli 1.7
Ubuntu 22.04 LTS nvme-cli 1.16
20.04 LTS nvme-cli 1.9
Proxmox VE 7.x nvme-cli 1.12

Changelog (auszugsweise):

NVMe-CLI Version Release Date Changes
v2.1-rc0 14.07.2022 new solidigm plugin
v2.0 08.04.2022 first release of nvme-cli 2
v2.0-rc7 18.03.2022 add transcend, virtium plugin commands
v2.0-rc6 11.03.2022 cmds-main: Add intel plugin commands

cmds-plugins: Add huawei plugin commands

v2.0-rc4 22.02.2022 Micron and NetApp plugin got a few fixes
v2.0-rc3 11.02.2022 update wdc plugin version to 1.16.3
v2.0-rc0 14.01.2022 code base of nvme-cli has been splitted into a nvme-cli and libnvme

a lot's of cleanups and refactoring

NVMe-CLI Installation

Unter Debian und Ubuntu wird NVMe-CLI via apt installiert:

apt install nvme-cli

Unter FreeBSD erfolgt die Installation folgendermaßen:

pkg install nvme-cli

NVMe-CLI Funktionsübersicht

nvme help

test@ubuntu-22-04:~$ nvme help
nvme-1.16
usage: nvme <command> [<device>] [<args>]

The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).

The following are all implemented sub-commands:
  list                      List all NVMe devices and namespaces on machine
  list-subsys               List nvme subsystems
  id-ctrl                   Send NVMe Identify Controller
  id-ns                     Send NVMe Identify Namespace, display structure
  id-ns-granularity         Send NVMe Identify Namespace Granularity List, display structure
  list-ns                   Send NVMe Identify List, display structure
  list-ctrl                 Send NVMe Identify Controller List, display structure
  nvm-id-ctrl               Send NVMe Identify Controller NVM Command Set, display structure
  primary-ctrl-caps         Send NVMe Identify Primary Controller Capabilities
  list-secondary            List Secondary Controllers associated with a Primary Controller
  cmdset-ind-id-ns          I/O Command Set Independent Identify Namespace
  ns-descs                  Send NVMe Namespace Descriptor List, display structure
  id-nvmset                 Send NVMe Identify NVM Set List, display structure
  id-uuid                   Send NVMe Identify UUID List, display structure
  id-iocs                   Send NVMe Identify I/O Command Set, display structure
  id-domain                 Send NVMe Identify Domain List, display structure
  list-endgrp               Send NVMe Identify Endurance Group List, display structure
  create-ns                 Creates a namespace with the provided parameters
  delete-ns                 Deletes a namespace from the controller
  attach-ns                 Attaches a namespace to requested controller(s)
  detach-ns                 Detaches a namespace from requested controller(s)
  get-ns-id                 Retrieve the namespace ID of opened block device
  get-log                   Generic NVMe get log, returns log in raw format
  telemetry-log             Retrieve FW Telemetry log write to file
  fw-log                    Retrieve FW Log, show it
  changed-ns-list-log       Retrieve Changed Namespace List, show it
  smart-log                 Retrieve SMART Log, show it
  ana-log                   Retrieve ANA Log, show it
  error-log                 Retrieve Error Log, show it
  effects-log               Retrieve Command Effects Log, show it
  endurance-log             Retrieve Endurance Group Log, show it
  predictable-lat-log       Retrieve Predictable Latency per Nvmset Log, show it
  pred-lat-event-agg-log    Retrieve Predictable Latency Event Aggregate Log, show it
  persistent-event-log      Retrieve Presistent Event Log, show it
  endurance-event-agg-log   Retrieve Endurance Group Event Aggregate Log, show it
  lba-status-log            Retrieve LBA Status Information Log, show it
  resv-notif-log            Retrieve Reservation Notification Log, show it
  boot-part-log             Retrieve Boot Partition Log, show it
  get-feature               Get feature and show the resulting value
  device-self-test          Perform the necessary tests to observe the performance
  self-test-log             Retrieve the SELF-TEST Log, show it
  supported-log-pages       Retrieve the Supported Log pages details, show it
  set-feature               Set a feature and show the resulting value
  set-property              Set a property and show the resulting value
  get-property              Get a property and show the resulting value
  format                    Format namespace with new block format
  fw-commit                 Verify and commit firmware to a specific slot (fw-activate in old version < 1.2)
  fw-download               Download new firmware
  admin-passthru            Submit an arbitrary admin command, return results
  io-passthru               Submit an arbitrary IO command, return results
  security-send             Submit a Security Send command, return results
  security-recv             Submit a Security Receive command, return results
  get-lba-status            Submit a Get LBA Status command, return results
  capacity-mgmt             Submit Capacity Management Command, return results
  resv-acquire              Submit a Reservation Acquire, return results
  resv-register             Submit a Reservation Register, return results
  resv-release              Submit a Reservation Release, return results
  resv-report               Submit a Reservation Report, return results
  dsm                       Submit a Data Set Management command, return results
  copy                      Submit a Simple Copy command, return results
  flush                     Submit a Flush command, return results
  compare                   Submit a Compare command, return results
  read                      Submit a read command, return results
  write                     Submit a write command, return results
  write-zeroes              Submit a write zeroes command, return results
  write-uncor               Submit a write uncorrectable command, return results
  verify                    Submit a verify command, return results
  sanitize                  Submit a sanitize command
  sanitize-log              Retrieve sanitize log, show it
  reset                     Resets the controller
  subsystem-reset           Resets the subsystem
  ns-rescan                 Rescans the NVME namespaces
  show-regs                 Shows the controller registers or properties. Requires character device
  discover                  Discover NVMeoF subsystems
  connect-all               Discover and Connect to NVMeoF subsystems
  connect                   Connect to NVMeoF subsystem
  disconnect                Disconnect from NVMeoF subsystem
  disconnect-all            Disconnect from all connected NVMeoF subsystems
  gen-hostnqn               Generate NVMeoF host NQN
  show-hostnqn              Show NVMeoF host NQN
  dir-receive               Submit a Directive Receive command, return results
  dir-send                  Submit a Directive Send command, return results
  virt-mgmt                 Manage Flexible Resources between Primary and Secondary Controller
  rpmb                      Replay Protection Memory Block commands
  fid-support-effects-log   Submit Feature ID Support and Effects Log, Return result
  lockdown                  Submit a Lockdown command,return result
  version                   Shows the program version
  help                      Display this help

See 'nvme help <command>' for more information on a specific command

The following are all installed plugin extensions:
  ymtc            Ymtc vendor specific extensions
  nvidia          NVIDIA vendor specific extensions
  zns             Zoned Namespace Command Set
  transcend       Transcend vendor specific extensions
  sfx             ScaleFlux vendor specific extensions
  dera            Dera vendor specific extensions
  shannon         Shannon vendor specific extensions
  virtium         Virtium vendor specific extensions
  seagate         Seagate vendor specific extensions
  micron          Micron vendor specific extensions
  toshiba         Toshiba NVME plugin
  netapp          NetApp vendor specific extensions
  huawei          Huawei vendor specific extensions
  wdc             Western Digital vendor specific extensions
  memblaze        Memblaze vendor specific extensions
  lnvm            LightNVM specific extensions
  amzn            Amazon vendor specific extensions
  intel           Intel vendor specific extensions

See 'nvme <plugin> help' for more information on a plugin

nvme micron help

test@ubuntu-22-04:~$ nvme micron help
nvme-1.16
usage: nvme micron <command> [<device>] [<args>]

The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).

Micron vendor specific extensions

The following are all implemented sub-commands:
  select-download                  Selective Firmware Download
  vs-temperature-stats             Retrieve Micron temperature statistics
  vs-pcie-stats                    Retrieve Micron PCIe error stats
  clear-pcie-correctable-errors    Clear correctable PCIe errors
  vs-internal-log                  Retrieve Micron logs
  vs-telemetry-controller-option   Enable/Disable controller telemetry log generation
  vs-nand-stats                    Retrieve NAND Stats
  vs-drive-info                    Retrieve Drive information
  plugin-version                   Display plugin version info
  cloud-SSD-plugin-version         Display plugin version info
  log-page-directory               Retrieve log page directory
  vs-fw-activate-history           Display FW activation history
  vs-error-reason-identifier       Retrieve Error reason
  vs-smart-add-log                 Retrieve extended SMART data
  clear-fw-activate-history        Clear FW activation history
  vs-smbus-option                  Enable/Disable SMBUS on the drive
  version                          Shows the program version
  help                             Display this help

See 'nvme micron help <command>' for more information on a specific command

nvme toshiba help

test@ubuntu-22-04:~$ nvme toshiba help
nvme-1.16
usage: nvme toshiba <command> [<device>] [<args>]

The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).

Toshiba NVME plugin

The following are all implemented sub-commands:
  vs-smart-add-log                Extended SMART information
  vs-internal-log                 Get Internal Log
  clear-pcie-correctable-errors   Clear PCIe correctable error count
  version                         Shows the program version
  help                            Display this help

See 'nvme toshiba help <command>' for more information on a specific command

nvme wdc help

Für WDC SSDs stehen folgende Kommandos zur Verfügung (Details zu 'drive-resize' siehe Drive-Resize von Western Digital NVME SSDs):

test@ubuntu-22-04:~$ nvme wdc help
nvme-1.16
usage: nvme wdc <command> [<device>] [<args>]

The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).

Western Digital vendor specific extensions

The following are all implemented sub-commands:
  cap-diag                         WDC Capture-Diagnostics
  drive-log                        WDC Drive Log
  get-crash-dump                   WDC Crash Dump
  get-pfail-dump                   WDC Pfail Dump
  id-ctrl                          WDC identify controller
  purge                            WDC Purge
  purge-monitor                    WDC Purge Monitor
  vs-internal-log                  WDC Internal Firmware Log
  vs-nand-stats                    WDC NAND Statistics
  vs-smart-add-log                 WDC Additional Smart Log
  clear-pcie-correctable-errors    WDC Clear PCIe Correctable Error Count
  drive-essentials                 WDC Drive Essentials
  get-drive-status                 WDC Get Drive Status
  clear-assert-dump                WDC Clear Assert Dump
  drive-resize                     WDC Drive Resize
  vs-fw-activate-history           WDC Get FW Activate History
  clear-fw-activate-history        WDC Clear FW Activate History
  enc-get-log                      WDC Get Enclosure Log
  vs-telemetry-controller-option   WDC Enable/Disable Controller Initiated Telemetry Log
  vs-error-reason-identifier       WDC Telemetry Reason Identifier
  log-page-directory               WDC Get Log Page Directory
  namespace-resize                 WDC NamespaceDrive Resize
  vs-drive-info                    WDC Get Drive Info
  vs-temperature-stats             WDC Get Temperature Stats
  capabilities                     WDC Device Capabilities
  cloud-SSD-plugin-version         WDC Cloud SSD Plugin Version
  vs-pcie-stats                    WDC VS PCIE Statistics
  get-latency-monitor-log          WDC Get Latency Monitor Log Page
  version                          Shows the program version
  help                             Display this help

See 'nvme wdc help <command>' for more information on a specific command

nvme intel help

test@ubuntu-22-04:~$ nvme intel help
nvme-1.16
usage: nvme intel <command> [<device>] [<args>]

The '<device>' may be either an NVMe character device (ex: /dev/nvme0) or an
nvme block device (ex: /dev/nvme0n1).

Intel vendor specific extensions

The following are all implemented sub-commands:
  id-ctrl                 Send NVMe Identify Controller
  internal-log            Retrieve Intel internal firmware log, save it
  lat-stats               Retrieve Intel IO Latency Statistics log, show it
  set-bucket-thresholds   Set Latency Stats Bucket Values, save it
  lat-stats-tracking      Enable and disable Latency Statistics logging.
  market-name             Retrieve Intel Marketing Name log, show it
  smart-log-add           Retrieve Intel SMART Log, show it
  temp-stats              Retrieve Intel Temperature Statistics log, show it
  version                 Shows the program version
  help                    Display this help

See 'nvme intel help <command>' for more information on a specific command

NVMe-CLI Beispiele

Die folgenden Ausgaben wurden auf einem Ubuntu 22.04 System mit einer ATP M.2 NVMe SSD gesammelt.

nvme list

test@ubuntu-22-04:~$ sudo nvme list
Node                  SN                   Model                                    Namespace Usage                      Format           FW Rev
--------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1          20040089-000002      ATP NVMe M.2 2280 SSD                    1           5,08  GB / 120,03  GB    512   B +  0 B   42A0S79A

nvme list-subsys

test@ubuntu-22-04:~$ sudo nvme list-subsys
nvme-subsys0 - NQN=nqn.2014.08.org.nvmexpress:1db21db220040089-000002     ATP NVMe M.2 2280 SSD
\
 +- nvme0 pcie 0000:01:00.0 live

Zusätzlich hier die Ausgabe eine Proxmox VE 7.x Systems mit vier Western Digital SN640 TCG U.2 NVMe SSDs:

root@pmx01:~# nvme list-subsys
nvme-subsys0 - NQN=nqn.2018-01.com.wdc:NGUID:0014EE830220B7800000000000000000
\
 +- nvme0 pcie 0000:84:00.0 live
nvme-subsys1 - NQN=nqn.2018-01.com.wdc:NGUID:0014EE830220B0000000000000000000
\
 +- nvme1 pcie 0000:85:00.0 live
nvme-subsys2 - NQN=nqn.2018-01.com.wdc:NGUID:0014EE830220B7000000000000000000
\
 +- nvme2 pcie 0000:86:00.0 live
nvme-subsys3 - NQN=nqn.2018-01.com.wdc:NGUID:0014EE830220B4000000000000000000
\
 +- nvme3 pcie 0000:87:00.0 live

nvme smart-log /dev/nvme0n1

test@ubuntu-22-04:~$ sudo nvme smart-log /dev/nvme0n1
Smart Log for NVME device:nvme0n1 namespace-id:ffffffff
critical_warning                        : 0
temperature                             : 38 C (311 Kelvin)
available_spare                         : 100%
available_spare_threshold               : 10%
percentage_used                         : 0%
endurance group critical warning summary: 0
data_units_read                         : 314.978
data_units_written                      : 197.916
host_read_commands                      : 1.739.034
host_write_commands                     : 2.384.025
controller_busy_time                    : 46
power_cycles                            : 106
power_on_hours                          : 68
unsafe_shutdowns                        : 59
media_errors                            : 0
num_err_log_entries                     : 0
Warning Temperature Time                : 0
Critical Composite Temperature Time     : 0
Temperature Sensor 1           : 27 C (300 Kelvin)
Temperature Sensor 2           : 38 C (311 Kelvin)
Thermal Management T1 Trans Count       : 0
Thermal Management T2 Trans Count       : 0
Thermal Management T1 Total Time        : 0
Thermal Management T2 Total Time        : 0

nvme fw-log /dev/nvme0n1

test@ubuntu-22-04:~$ sudo nvme fw-log /dev/nvme0n1
Firmware Log for device:nvme0n1
afi  : 0x11
frs1 : 42A0S79A
frs2 : 42A0S79A

nvme error-log /dev/nvme0n1

test@ubuntu-22-04:~$ sudo nvme error-log /dev/nvme0n1
Error Log Entries for device:nvme0n1 entries:64
.................
 Entry[ 0]
.................
error_count     : 0
sqid            : 0
cmdid           : 0
status_field    : 0(SUCCESS: The command completed successfully)
phase_tag       : 0
parm_err_loc    : 0
lba             : 0
nsid            : 0
vs              : 0
trtype          : The transport type is not indicated or the error is not transport related.
cs              : 0
trtype_spec_info: 0
[...]
.................
 Entry[63]
.................
error_count     : 0
sqid            : 0
cmdid           : 0
status_field    : 0(SUCCESS: The command completed successfully)
phase_tag       : 0
parm_err_loc    : 0
lba             : 0
nsid            : 0
vs              : 0
trtype          : The transport type is not indicated or the error is not transport related.
cs              : 0
trtype_spec_info: 0
.................

nvme effects-log /dev/nvme0n1

test@ubuntu-22-04:~$ sudo nvme effects-log /dev/nvme0n1
Admin Command Set
ACS0     [Delete I/O Submission Queue     ] 00000001
ACS1     [Create I/O Submission Queue     ] 00000001
ACS2     [Get Log Page                    ] 00000001
ACS4     [Delete I/O Completion Queue     ] 00000001
ACS5     [Create I/O Completion Queue     ] 00000001
ACS6     [Identify                        ] 00000001
ACS8     [Abort                           ] 00000001
ACS9     [Set Features                    ] 00000001
ACS10    [Get Features                    ] 00000001
ACS12    [Asynchronous Event Request      ] 00000001
ACS16    [Firmware Commit                 ] 00000011
ACS17    [Firmware Image Download         ] 00000001
ACS20    [Device Self-test                ] 00000001
ACS128   [Format NVM                      ] 00010003
ACS129   [Security Send                   ] 00000003
ACS130   [Security Receive                ] 00000001
ACS132   [Sanitize                        ] 00010003
ACS192   [Unknown                         ] 00000017
ACS193   [Unknown                         ] 00000017
ACS194   [Unknown                         ] 00000001
ACS224   [Unknown                         ] 00000001
ACS228   [Unknown                         ] 00000001
ACS229   [Unknown                         ] 00000001
ACS230   [Unknown                         ] 00000001

NVM Command Set
IOCS0    [Flush                           ] 00000003
IOCS1    [Write                           ] 00000003
IOCS2    [Read                            ] 00000001
IOCS4    [Write Uncorrectable             ] 00000003
IOCS5    [Compare                         ] 00000001
IOCS8    [Write Zeroes                    ] 00000003
IOCS9    [Dataset Management              ] 00000003

Weitere Informationen


Foto Werner Fischer.jpg

Autor: Werner Fischer

Werner Fischer arbeitet im Product Management Team von Thomas-Krenn. Er evaluiert dabei neueste Technologien und teilt sein Wissen in Fachartikeln, bei Konferenzen und im Thomas-Krenn Wiki. Bereits 2005 - ein Jahr nach seinem Abschluss des Studiums zu Computer- und Mediensicherheit an der FH Hagenberg - heuerte er beim bayerischen Server-Hersteller an. Als Öffi-Fan nutzt er gerne Bus & Bahn und genießt seinen morgendlichen Spaziergang ins Büro.


Das könnte Sie auch interessieren

M.2 und mSATA SSDs in Thomas-Krenn Servern
SATA CRC Error Count
Solid-State Drive