NVMe command is a helpful that can print useful hardware status and information from installed NVMe devices. Will list a few common use of this command here. You will need to be root to both install and use these commands.
Installation
sudo yum install nvme-cli
sudo apt install nvme-cli
Full list of commands, you can use 'nvme -h'
nvme -h
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
list-ns Send NVMe Identify List, display structure
ns-descs Send NVMe Namespace Descriptor List, display structure
id-nvmset Send NVMe Identify NVM Set 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)
list-ctrl Send NVMe Identify Controller List, display structure
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
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
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
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
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
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
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
version Shows the program version
help Display this help
List NVMe devices
#I purposely 'x'ed out the last 5 digits in each SN# listed
root@exx:/home/exx# nvme list
Node SN Model Namespace Usage Format FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1 1936242xxxxx Micron_2200_MTFDHBA512TCK 1 512.11 GB / 512.11 GB 512 B + 0 B P1MU003
/dev/nvme1n1 1936242xxxxx Micron_2200_MTFDHBA512TCK 1 512.11 GB / 512.11 GB 512 B + 0 B P1MU003
'lsblk' can be used to quickly view ALL installed drives and partitions:
root@exx:/home/exx# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55.4M 1 loop /snap/core18/1944
loop1 7:1 0 69.9M 1 loop /snap/lxd/19188
loop2 7:2 0 31.1M 1 loop /snap/snapd/10707
loop3 7:3 0 55.5M 1 loop /snap/core18/1988
loop4 7:4 0 32.3M 1 loop /snap/snapd/11107
sda 8:0 0 12.8T 0 disk
└─sda1 8:1 0 12.8T 0 part /data
nvme0n1 259:0 0 477G 0 disk
└─nvme0n1p1 259:2 0 477G 0 part /scr
nvme1n1 259:1 0 477G 0 disk
├─nvme1n1p1 259:3 0 512M 0 part /boot/efi
├─nvme1n1p2 259:4 0 500M 0 part /boot
├─nvme1n1p3 259:5 0 10G 0 part [SWAP]
└─nvme1n1p4 259:6 0 466G 0 part /
NVMe smart-log output
You can find current NVMe device temperature and critical warnings as long as you know which NVMe device you need the output from.
You need to run these with 'root' permission.
sudo bash
<root password>
Then target your NVMe device with this command:
sudo nvme smart-log <device name>
sudo nvme smart-log /dev/nvme0n1