created: 2023-08-23 18:19:59 (+00:00; UTC; UTC)
last modified: 2023-08-27 18:02:40 (+00:00; UTC; UTC)

NVMe Cheat Sheet

List Devices


nvme list

SMART Info


nvme smart-log /dev/nvme0

nvme smart-log-add /dev/nvme0

nvme error-log /dev/nvme0

Check Support


nvme id-ctrl -H /dev/nvme0n1

oacs    : 0x17
  [1:1] : 0x1 Format NVM Supported
fna     : 0
  [2:2] : 0 Crypto Erase Not Supported as part of Secure Erase

[2:2] : 0   Overwrite Sanitize Operation Not Supported
[1:1] : 0x1 Block Erase Sanitize Operation Supported
[0:0] : 0   Crypto Erase Sanitize Operation Not Supported

nvme id-ns -H /dev/nvme0n1

[6:5] : 0     Most significant 2 bits of Current LBA Format Selected
[3:0] : 0     Least significant 4 bits of Current LBA Format Selected
LBA Format  0 : Metadata Size: 0   bytes – Data Size: 512 bytes – Relative Performance: 0 Best (in use)
LBA Format  1 : Metadata Size: 8   bytes – Data Size: 512 bytes – Relative Performance: 0 Best
LBA Format  2 : Metadata Size: 0   bytes – Data Size: 4096 bytes – Relative Performance: 0 Best
LBA Format  3 : Metadata Size: 8   bytes – Data Size: 4096 bytes – Relative Performance: 0 Best
LBA Format  4 : Metadata Size: 64  bytes – Data Size: 4096 bytes – Relative Performance: 0 Best

Format No Secure Erase (TRIM/Deallocate LBAs)


nvme format /dev/nvme0n1 --ses=0

Format Crypto Erase


nvme format /dev/nvme0n1 --ses=2

Format User Data Erase


nvme format /dev/nvme0n1 --ses=1

Format Change Native Sector Size


nvme format --lbaf=1 /dev/nvme0n1

Sanitize Crypto Erase


nvme sanitize -a 0x4 /dev/nvme0n1

Sanitize Block Erase


nvme sanitize -a 0x2 /dev/nvme0n1

Sanitize Status


nvme sanitize-log /dev/nvme0n1

Running


Sanitize Progress                      (SPROG) :  16704
Sanitize Status                        (SSTAT) :  0x2

Complete


Sanitize Progress                      (SPROG) :  65535
Sanitize Status                        (SSTAT) :  0x101

Sources/Links

2023-08-23