< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

方法一:hwinfo --disk

例子sda

复制代码
$ hwinfo --disk
28: IDE 00.0: 10600 Disk                                        
  [Created at block.245]
  Unique ID: 3OOL.XxO12I_gR04
  Parent ID: _+Pw.BwJ_Mdxf5A3
  SysFS ID: /class/block/sda
  SysFS BusID: 0:0:0:0
  SysFS Device Link: /devices/pci0000:00/0000:00:0f.0/ata1/host0/target0:0:0/0:0:0:0
  Hardware Class: disk
  Model: "KINGSTON RBUSMS1"
  Vendor: "KINGSTON"
  Device: "RBUSMS1"
  Revision: "61D1"
  Driver: "ahci", "sd"
  Driver Modules: "ahci", "sd_mod"
  Device File: /dev/sda
  Device Files: /dev/sda, /dev/disk/by-id/ata-KINGSTON_RBUSMS180S364GJ_50026B72821EF73A, /dev/disk/by-path/pci-0000:00:0f.0-ata-1, /dev/disk/by-id/wwn-0x50026b72821ef73a
  Device Number: block 8:0-8:15
  BIOS id: 0x80
  Drive status: no medium
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #14 (SATA controller)
复制代码

例子nvme

复制代码
generic@generic-PC:/$ hwinfo --disk
14: PCI 00.0: 10600 Disk                                        
  [Created at block.245]
  Unique ID: wLCS.FG_TsB9ija0
  Parent ID: B35A.iiLHwdxfB34
  SysFS ID: /class/block/nvme0n1
  SysFS BusID: nvme0
  SysFS Device Link: /devices/pci0000:00/0000:00:01.0/0000:02:00.0/nvme/nvme0
  Hardware Class: disk
  Model: "Disk"
  Vendor: pci 0x1df5 
  Device: pci 0x1202 
  SubVendor: pci 0x1df5 
  SubDevice: pci 0x1202 
  Driver: "nvme"
  Driver Modules: "nvme"
  Device File: /dev/nvme0n1
  Device Files: /dev/nvme0n1, /dev/disk/by-id/nvme-kimtigo_SSD_256GB_S780100G00110S, /dev/disk/by-path/pci-0000:02:00.0-nvme-1, /dev/disk/by-id/nvme-eui.0100000000000000
  Device Number: block 259:0
  Drive status: no medium
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #2 (Non-Volatile memory controller)
复制代码

 

方法二:cat /sys/class/block/sda/device/wwid或者cat /sys/class/block/nvme0n1/device/serial

 sda

$ cat /sys/class/block/sda/device/wwid 
t10.ATA     KINGSTON RBUSMS180S364GJ                50026B72821EF73A    

 nvme

cat /sys/class/block/nvme0n1/device/serial 
S780100G00110S      

 

方法三:udevadm info --query=all --name=/dev/xxx |grep -w ID_SERIAL_SHORT

$ udevadm info --query=all --name=/dev/sda |grep -w ID_SERIAL_SHORT
E: ID_SERIAL_SHORT=50026B72821EF73A
$ udevadm info --query=all --name=/dev/nvme0n1 |grep -w ID_SERIAL_SHORT
E: ID_SERIAL_SHORT=S780100G00110S

 

方法四:lsblk -n --nodeps -o name,serial /dev/xxx

$ lsblk -n --nodeps -o name,serial /dev/sda
sda  50026B72821EF73A

 

lsblk -n --nodeps -o name,serial /dev/nvme0n1
nvme0n1 S780100G00110S

 

posted on   陌鉎こ城sHi  阅读(5815)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示