如何读取Linux内核磁盘序列号

如何读取Linux内核磁盘序列号,第1张

lrwxrwxrwx 1 root root 9 10月 17 10:11 scsi-SATA_ST3500413AS_Z2A2AGQA ->../../sdb

可以看到,一个磁盘可以用传统的/dev/sdX来索引,也可以by-YY来索引,其中by-id就是以序列号来索引,上述输出中,下划线后面的就是序列号。同样,我们可以用hdparm工具程序来读取,可以读到同样的结果。

root@localhost:~# fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes

255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

/dev/sda1 1 3907029167 1953514583+ ee GPT

root@localhost:~# hdparm -i /dev/sda1

/dev/sda1:

Model=WDC WD2003FYYS-02W0B1, FwRev=01.01D02, SerialNo=WD-WMAY04598673

Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }

RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50

BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=16

CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=3907029168

IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}

PIO modes: pio0 pio3 pio4

DMA modes: mdma0 mdma1 mdma2

UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6

AdvancedPM=yes: unknown setting WriteCache=enabled

Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7

* signifies the current active mode

LINUX查询工作站多硬盘的硬盘序列号方法:

1、确认安装yaourt hdparm

2、运行下面命令查看共有多少硬盘

[root@myhost detect]# fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes

255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Device Boot Start End Blocks Id System

/dev/sda1 * 63 385559 192748+ 83 Linux

/dev/sda2 385560 4385744 2000092+ 82 Linux swap / Solaris

/dev/sda3 438574514378174 4996215 83 Linux

/dev/sda414378175 625137344 3053795855 Extended

/dev/sda5143782383437909910000431 83 Linux

/dev/sda63437916344371529 4996183+ 83 Linux

/dev/sda7443715937561795415623181 83 Linux

/dev/sda875618018 10686437915623181 83 Linux

/dev/sda9 106864443 12686530410000431 83 Linux

/dev/sda10 126865368 625137344 249135988+ 83 Linux

由上可见,只有一个硬盘sda,其中,sda1到sda10是说该硬盘共有十个分区。

多个硬盘的话会看到sdb、sdc等;

3、查看sda硬盘的序列号,

[root@myhost detect]# hdparm -i /dev/sda

/dev/sda:

Model=ST3320418AS, FwRev=CC66, SerialNo=6VMDEMJM

Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }

RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4

BuffType=unknown, BuffSize=16384kB, MaxMultSect=16, MultSect=16

CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=625142448

IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}

PIO modes: pio0 pio1 pio2 pio3 pio4

DMA modes: mdma0 mdma1 mdma2

UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5

AdvancedPM=no WriteCache=enabled

Drive conforms to: unknown: ATA/ATAPI-4,5,6,7

由上可见,sda硬盘的序列号为6VMDEMJM。

同理查看其它硬盘序列号。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8791972.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-21
下一篇 2023-04-21

发表评论

登录后才能评论

评论列表(0条)

保存