List features of NVMe drive (like hdparm -I for non-NVME)

hdparmnvmesmartctl

With a non-NVMe drive, I can run:

# hdparm -I /dev/whatever | grep TRIM
Data Set Management TRIM supported (limit 8 block)
Deterministic read data after TRIM

With a Samsung 960 EVO 1TB NVMe drive (PCI Express), I get:

# hdparm -I /dev/nvme0n1
/dev/nvme0n1:
 HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device

I can run

# smartctl --all /dev/nvme0n1

And get some information about the drive, but nothing about TRIM type.

I installed nvme-cli, and ran nvme get-feature -f 0 to -f 0xe and got some features from the drive, but nothing about TRIM type.

Is there a way in Linux to query an NVME device, to list what type of TRIM it supports?

Is there a way in Linux to query an NVMe device, to get a list of anything else hdparm -I would show if it weren't an NVMe, that smartctl and nvme don't seem to cover?

Best Answer

I understand that TRIM is equivalent to NVME Data Set Management (DSM) Deallocate. If it is supported, it can be applied to 256 regions up to 16 blocks in size each.

Check id-ctrl command oncs.bit2 if it is supported.

# nvme id-ctrl /dev/nvme1 -H
oncs    : 0x6
  [5:5] : 0 Reservations Not Supported
  [4:4] : 0 Save and Select Not Supported
  [3:3] : 0 Write Zeroes Not Supported
  [2:2] : 0x1   Data Set Management Supported
  [1:1] : 0x1   Write Uncorrectable Supported
  [0:0] : 0 Compare Not Supported

These commands can give you more information about the nvme device:

nvme id-ctrl /dev/nvme0 -H
nvme id-ns /dev/nvme0n1 -H
nvme show-regs /dev/nvme0n1 -H
Related Question