How to get the serial number of nvme SSD?

BalrogMithrandir

New Member
Joined
Mar 29, 2019
Messages
5
Reaction score
3
Credits
0
I want to get the unique ID from a nvme hard disk without nvme-cli. The unique ID should not change when partition the nvme again, or change the filesystem's type.
I've thought the "Partition unique GUID" of nvme0n1 or the Linux UUID of nvme0n1p1, but Partition unique GUID will change when re-partion the hard disk, and the LinuxUUID will change when change the file system?
So I think the Serial Number is the ID I want , but I can not get it.
I also find the "Disk identifier (GUID): E37EBCC8-2251-420B-B2A6-3B515E3D2892", but I do not sure will it chang?
How could i do ? Thank you !
 


Try
Code:
sudo lshw -C disk
That shows me the serial number of my SSD. Perhaps will work for 'nvme'?
Or did you want to do this with a GUI application?
 
A Tolkien fan? :) (Wizard appears in a puff of smoke)

Welcome @BalrogMithrandir to linux.org, and may the hairs on your toes grow long :D

What Linux Distribution are you using?

The command may vary, and in some cases require installing, and the use of sudo.

Cheers

Chris Turner
wizardfromoz
 
Try
Code:
sudo lshw -C disk
That shows me the serial number of my SSD. Perhaps will work for 'nvme'?
Or did you want to do this with a GUI application?

Thank you for reply! I tried the command "sudo lshw -C disk", and find it do not work with nvme disk, and I can not do this with a GUI application also. Our linux system is not easy to add some new application.
 
A Tolkien fan? :) (Wizard appears in a puff of smoke)

Welcome @BalrogMithrandir to linux.org, and may the hairs on your toes grow long:D

What Linux Distribution are you using?

The command may vary, and in some cases require installing, and the use of sudo.

Cheers

Chris Turner
wizardfromoz

May the Eru bless you :D ! And yes ,a tolkien fan, or a fan of Gandalf and amazing creature:).
And thank you for replay my question!
My linux distribution is ubuntu 14.04, I know the nvme-cli could help, but I do not want to install it if there are any other method. Thank you again!
 
I have solved this question by calling "ioctl " function to send ioctl command to read the serial number from nvme disk in my c code. The code could refer to nvme-cli's code in nvme.c and nvme-ioctl.c. Thank you all here!
 
saw question asked without nvme-cli, but for others searching how to find NVME serial#:
sudo apt-get install nvme-cli
nvme list
 
Last edited:
Try this:
Code:
sudo lshw -C volume
It may work on NVMe devices.
 

Members online


Top