- How to check serial number of NVMe disk?
- 4 Answers 4
- Use this Linux command-line tool to learn more about your NVMe drives
- Install nvme-cli
- Exploring an NVMe drive
- List all NVMe drives
- Drive health
- Formatting an NVMe drive
- Securely erasing an NVMe drive
- Try nvme-cli
- Linux commands to display your hardware information
- Linux — как получить информацию про NVME диски, SMART
- How can I check the NVME specs
- 2 Answers 2
- lsblk (List Block)
- Create an alias for arguments
- Voltage / Power
How to check serial number of NVMe disk?
However it does not work for NVMe disks (nvme0n0, nvme0n1 etc). No information about serial number is provided.
Note that newer versions of lsblk (e.g. mine is from util-linux 2.33.1) do return the serial number for NVMe disks too.
4 Answers 4
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
You can use good old sysfs and cat for that:
$ cat /sys/block/nvme0n1/device/serial PHNH912345441P0B
Also as @VZ pointed out modern versions of lsblk will output serial numbers for NVMe drives correctly. Example:
$ lsblk -d -o TRAN,NAME,TYPE,MODEL,SERIAL,SIZE TRAN NAME TYPE MODEL SERIAL SIZE mmcblk0 disk 0xda61bcdf 14.6G mmcblk0boot0 disk 0xda61bcdf 4M mmcblk0boot1 disk 0xda61bcdf 4M nvme nvme0n1 disk INTEL SSDPEKNW010T8 PHNH912345441P0B 953.9G
Note that there are two kinds of M.2 drives — the NVMe and the SATA — and they present completely different interfaces.
This is as evidenced by the completely different dev device name: /dev/sd? for SATA, 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.
Use this Linux command-line tool to learn more about your NVMe drives
The nvme-cli command has lots of useful options, and it’s a great way to take control of how you manage your data.
NVMe stands for Non-Volatile Memory Express, and it refers to how software and storage communicate across PCIe and other protocols, including TCP. It’s an open specification led by a non-profit organization and defines several forms of solid-state storage.
My laptop has an NVMe drive, as does my desktop. And they’re fast. I love how quickly my computers boot and how quickly they’re able to read and write data. There’s no perceptible delay.
It also didn’t take long for me to get curious about the technology driving this ultra-fast storage, so I did a little investigation. I learned that NVMe drives consume less power while delivering much faster access to data compared to even SSD drives over SATA. That was interesting, but I wanted to know more about my particular NVMe drives, and I wanted to know how they compared with other drives. Could I securely erase the drive? How could I check its integrity?
Those questions led me to an Internet search that yielded an open source project with a collection of tools to manage NVMe drives. It’s called nvme-cli.
Install nvme-cli
You can install nvme-cli from your distribution’s package manager. For instance, on Fedora, CentOS, or similar:
On Debian, Mint, Elementary, and similar:
Exploring an NVMe drive
After installing nvme-cli for my distribution, I wanted to explore my drive. There’s no man page for nvme-cli , but you can get lots of help by entering nvme help :
$ nvme help nvme-1.14 usage: nvme [] [] The '' may be either an NVMe character device (ex: /dev/nvme0) or an nvme block device (ex: /dev/nvme0n1). 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 id-ns-granularity Send NVMe Identify Namespace Granularity List, display structure list-ns Send NVMe Identify List, display structure list-ctrl Send NVMe Identify Controller List, display structure nvm-id-ctrl Send NVMe Identify Controller NVM Command Set, display structure primary-ctrl-caps Send NVMe Identify Primary Controller Capabilities [. ]
List all NVMe drives
The sudo nvme list command lists all NVMe devices and namespaces on your machine. I used it and found an NVMe drive at /dev/nvme0n1 . Here is the output:
$ sudo nvme list Node SN Model Namespace Usage Format FW Rev --------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- -------- /dev/nvme0n1 S42GMY9M141281 SAMSUNG MZVLB256HAHQ-000L7 1 214.68 GB / 256.06 GB 512 B + 0 B 0L2QEXD7
I have a drive called nvme0n1 . It lists the serial number, brand, size, firmware revision, and so on.
You can get even more information about the drive and the features it supports by using the id-ctrl subcommand:
$ sudo nvme id-ctrl /dev/nvme0n1 NVME Identify Controller: vid : 0x144d ssvid : 0x144d sn : S42GMY9M141281 mn : SAMSUNG MZVLB256HAHQ-000L7 fr : 0L2QEXD7 rab : 2 ieee : 002538 cmic : 0 mdts : 9 cntlid : 0x4 ver : 0x10200 rtd3r : 0x186a0 rtd3e : 0x7a1200 [. ]
Drive health
You can read about the overall health of a drive with the smart-log subcommand:
$ sudo nvme smart-log /dev/nvme0n1 Smart Log for NVME device:nvme0n1 namespace-id:ffffffff critical_warning : 0 temperature : 21 C available_spare : 100% available_spare_threshold : 10% percentage_used : 2% endurance group critical warning summary: 0 data_units_read : 5,749,452 data_units_written : 10,602,948 host_read_commands : 77,809,121 host_write_commands : 153,405,213 controller_busy_time : 756 power_cycles : 1,719 power_on_hours : 1,311 unsafe_shutdowns : 129 media_errors : 0 num_err_log_entries : 1,243 Warning Temperature Time : 0 Critical Composite Temperature Time : 0 Temperature Sensor 1 : 21 C Temperature Sensor 2 : 22 C Thermal Management T1 Trans Count : 0 Thermal Management T2 Trans Count : 0 Thermal Management T1 Total Time : 0 Thermal Management T2 Total Time : 0
This provides you with the drive’s current temperature, the hours of use it’s had so far, how many times it was unsafely shut down, and so on.
Formatting an NVMe drive
You can format an NVMe drive with nvme-cli , but beware: This erases all of the data on the drive! If there’s important data on your drive, you must back it up before doing this, or else you will lose data. The subcommand is format :
$ sudo nvme format /dev/nvme0nX
(For safety, I’ve replaced the actual location of the drive with X to prevent copy-paste mishaps. Change the X to 1 or the appropriate location as listed in the results of nvme list .)
Securely erasing an NVMe drive
When you get ready to sell or dispose of your NVMe computer, you probably want to erase the drive securely. The same warnings apply here as with the format process: Back up important data first because this command erases it!
$ sudo nvme sanitize /dev/nvme0nX
Try nvme-cli
The nvme-cli command is released under a GPLv2 license. It’s a robust command with lots of useful options, and it’s a great way to take control of how you manage your data.
Linux commands to display your hardware information
Get the details on what’s inside your computer from the command line.
Linux — как получить информацию про NVME диски, SMART
Установка утилиты для получения информации об NVME SSD диска на CentOS 7:
Схема названия NVME дисков:
/dev/nvme(номер контроллера)n(пространство имён)p(раздел) /dev/nvme0n1p1 n - означает namespace, а p - partition
Показать список доступных NVME SSD дисков:
# nvme list Node SN Model Namespace Usage Format FW Rev ---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- -------- /dev/nvme0n1 1851B2803334 WDC CL SN720 SDAQNTW-512G-2000 1 512.11 GB / 512.11 GB 512 B + 0 B 10104122 /dev/nvme1n1 1851B2800287 WDC CL SN720 SDAQNTW-512G-2000 1 512.11 GB / 512.11 GB 512 B + 0 B 10104122
Показать информацию SMART для диска NVME SSD:
# nvme smart-log /dev/nvme0n1 Smart Log for NVME device:nvme0n1 namespace-id:ffffffff critical_warning : 0 temperature : 35 C available_spare : 100% available_spare_threshold : 10% percentage_used : 0% data_units_read : 26,485,796 data_units_written : 36,412,319 host_read_commands : 168,834,727 host_write_commands : 217,857,410 controller_busy_time : 672 power_cycles : 15 power_on_hours : 826 unsafe_shutdowns : 10 media_errors : 0 num_err_log_entries : 0 Warning Temperature Time : 0 Critical Composite Temperature Time : 0 Thermal Management T1 Trans Count : 0 Thermal Management T2 Trans Count : 0 Thermal Management T1 Total Time : 0 Thermal Management T2 Total Time : 0
Показать журнал ошибок NVME SSD диска:
Показать серийный номер и модель NVME SSD диска:
# nvme id-ctrl /dev/nvme0n1|egrep "sn|mn" sn : 1851B2803334 mn : WDC CL SN720 SDAQNTW-512G-2000
How can I check the NVME specs
How can I check the specs of the installed NVME other than lshw which only shows the brand. I am looking to know the model and voltage/power. Moreover, is there anything one should know before buying a new one to replace another (e.g. like SSDs, voltage and power)? CPU: i7-7700HQ
As far as I’m aware, NVMe is a standard, not a piece of hardware. So when you say «the installed NVMe», are you referring to the mobo/interface/connector, SSD, or something else?
2 Answers 2
lsblk (List Block)
You can use lsblk command:
$ lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,MODEL NAME FSTYPE LABEL MOUNTPOINT SIZE MODEL sdb 186.3G 2105 ├─sdb2 ntfs S3A6550D005 /media/rick/ 178.9G ├─sdb3 ntfs HDDRECOVERY 6G └─sdb1 ntfs TOSHIBA SYSTEM VOLUME 1.5G sda 931.5G HGST HTS721010A9 ├─sda4 ntfs WINRETOOLS 450M ├─sda2 128M ├─sda5 ntfs Image 11.4G ├─sda3 ntfs HGST_Win10 /mnt/d 919G └─sda1 vfat ESP 500M nvme0n1 477G Samsung SSD 960 PRO 512GB ├─nvme0n1p5 ext4 NVMe_Ubuntu_16.0 / 44.6G ├─nvme0n1p3 16M ├─nvme0n1p1 ntfs 450M ├─nvme0n1p6 swap Linux Swap [SWAP] 7.9G ├─nvme0n1p4 ntfs NVMe_Win10 /mnt/c 414.9G ├─nvme0n1p2 vfat /boot/efi 99M └─nvme0n1p7 ntfs Shared_WSL+Linux /mnt/e 9G
You can see my NVMe SSD is a Samsung SSD 960 PRO 512GB
Create an alias for arguments
As pointed out in comments a typo was made for MODEL and the output was incomplete. To avoid that in the future and more importantly so you don’t have to remember the arguments create an alias in ~/.bashrc called lsdrv which you can use all the time:
$ cat ~/.bashrc | grep lsdrv # Create lsdrv version of lsblk without UUID's alias lsdrv="lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,MODEL"
Now in the terminal you can simply use lsdrv to see all your drives complete with model number and other useful information.
Voltage / Power
This is pretty much irrelevant. The deciding factor is M.2 22×80 mm size or a different size. Also whether if it is Gen 3 x 2 or Gen 3 x 4 speed (the second is twice as fast).
For example I have two M.2 SSD bays the first one supports Gen 3 x 4 speeds the second one only supports Gen 3 x 2 speeds because there are a limited number of PCIe lanes on the Skylake chipset.
There may be other issues but this is what I remember off the top of my head. You should of course do your own research.
Basically you need to know the make and model of your computer to know the make and models of the M.2 NVMe SSDs you can install in it.