nvme

NVMe storage command line interface utility

TLDR

List all NVMe devices
$ sudo nvme list
Show controller identification
$ sudo nvme id-ctrl [/dev/nvme0]
Show namespace identification
$ sudo nvme id-ns [/dev/nvme0n1]
Show SMART health information
$ sudo nvme smart-log [/dev/nvme0]
Show error log entries
$ sudo nvme error-log [/dev/nvme0]
Format a namespace (destroys all data)
$ sudo nvme format [/dev/nvme0n1]
Download firmware to a device
$ sudo nvme fw-download [/dev/nvme0] --fw=[firmware.bin]
Run a device self-test
$ sudo nvme device-self-test [/dev/nvme0] --stc=[1]

SYNOPSIS

nvme command [device] [options]

DESCRIPTION

nvme is a user space utility providing standards-compliant tooling for NVM-Express (NVMe) drives on Linux. It has subcommands for all admin and I/O commands defined in the NVMe specification, as well as commands for displaying controller registers and retrieving various log pages.The utility supports NVMe-over-Fabrics operations including discovery, connect, and disconnect for remote NVMe subsystems. It can also submit completely arbitrary vendor-specific commands via passthrough.All commands return 0 on success and 1 on failure.

PARAMETERS

list

List all NVMe devices and namespaces.
id-ctrl DEVICE
Send an identify controller command and display the result.
id-ns DEVICE
Send an identify namespace command and display the result.
smart-log DEVICE
Retrieve SMART / health information log.
error-log DEVICE
Retrieve error information log.
fw-log DEVICE
Retrieve firmware slot information log.
format DEVICE
Format namespace(s) with specified LBA format.
fw-download DEVICE
Download firmware image to the device.
fw-activate DEVICE
Activate a downloaded firmware image.
sanitize DEVICE
Perform a sanitize operation (secure erase).
device-self-test DEVICE
Run a device self-test (short or extended).
get-feature DEVICE
Get a feature value from the controller.
set-feature DEVICE
Set a feature value on the controller.
discover
Discover NVMe-over-Fabrics subsystems.
connect DEVICE
Connect to an NVMe-over-Fabrics controller.
help COMMAND
Display help for a specific subcommand.

INSTALL

sudo apt install nvme-cli
sudo dnf install nvme-cli
sudo pacman -S nvme-cli
sudo apk add nvme-cli
sudo zypper install nvme-cli
nix profile install nixpkgs#nvme-cli

CAVEATS

Root privileges are required for most operations. The format and sanitize commands destroy all data on the device and are irreversible. The sanitize command cannot be aborted once started. NVMe-over-Fabrics commands require appropriate kernel modules.

HISTORY

nvme-cli is developed as an open-source project under the Linux NVMe project at https://github.com/linux-nvme/nvme-cli. It relies on Linux kernel NVMe IOCTLs and is Linux-specific.

SEE ALSO

smartctl(1), hdparm(8), lsblk(1)