How to check serial number of NVMe disk?

How to check serial number of NVMe disk?

To check serial number for sda and sdb I used:

sudo lsblk --raw -o name,type,serial

However it does not work for NVMe disks (nvme0n0, nvme0n1 etc). No information about serial number is provided.


Solution 1:

The nvme tool provides options to obtain NVME device information, for example, to install the tool, list the NVME devices and look at the id control fields on /dev/nvme0n1, one would use:

sudo apt-get install nvme-cli
sudo nvme list
sudo nvme id-ctrl /dev/nvme0n1

Solution 2:

Note that there are 2 kinds of M.2 drives - the NVME and the MSATA - and they present completely different interfaces.

This is as evidenced by the completely different dev device name: /dev/sd? for MSATA, and /dev/nvme0n1 for NVMe.

If you download smartmontools 6.6, it has experimental NVME support built in and can show serial number as I remember. (smartctl -a, again IIRC).

Otherwise, for NVMe drives you indeed need the nvme-cli tools to be able to do anything more than smartctl can do.