方法一:diskinfo命令
root@test:~ # diskinfo -v ada0
ada0
512 # sectorsize
500107862016 # mediasize in bytes (466G)
976773168 # mediasize in sectors
4096 # stripesize
0 # stripeoffset
969021 # Cylinders according to firmware.
16 # Heads according to firmware.
63 # Sectors according to firmware.
W2ATSQ9A # Disk ident.
结果:最后一行,Disk ident即是磁盘的sn。
方法二:geom命令
root@test:~ # geom disk list ada0
Geom name: ada0
Providers:
1. Name: ada0
Mediasize: 500107862016 (466G)
Sectorsize: 512
Stripesize: 4096
Stripeoffset: 0
Mode: r7w7e13
descr: ST500DM002-1BD142
lunid: 5000c50069a4dddd
ident: W2ATSQ9A
fwsectors: 63
fwheads: 16
结果: 倒数第三行,ident就是磁盘的序列号
方法三:camcontrol命令
root@test:~ # camcontrol identify ada0
pass0: <ST500DM002-1BD142 KC48> ATA-8 SATA 3.x device
pass0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
protocol ATA/ATAPI-8 SATA 3.x
device model ST500DM002-1BD142
firmware revision KC48
serial number W2ATSQ9A
WWN 5000c50069a4dddd
cylinders 16383
heads 16
sectors/track 63
sector size logical 512, physical 4096, offset 0
LBA supported 268435455 sectors
LBA48 supported 976773168 sectors
PIO supported PIO4
DMA supported WDMA2 UDMA6
media RPM 7200
……(后面还有一大堆)
结果:第六行的serial number,即是磁盘的序列号
方法四:smartctl,这个不在基本系统中,是一个ports,需要安装一下,可以用命令pkg install smartmontools
root@test:~ # smartctl -a /dev/ada0
smartctl 6.4 2015-06-04 r4109 [FreeBSD 10.1-RELEASE amd64] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 7200.14 (AF)
Device Model: ST500DM002-1BD142
Serial Number: W2ATSQ9A
LU WWN Device Id: 5 000c50 069a4dddd
Firmware Version: KC48
User Capacity: 500,107,862,016 bytes [500 GB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Rotation Rate: 7200 rpm
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA8-ACS T13/1699-D revision 4
SATA Version is: SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is: Sat Jul 25 09:57:07 2015 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
……(后面还有一大堆)
方法五:专用工具
对接在扩展卡上的磁盘,很可能不能直接看到序列号,需要扩展卡的专用工具才可以,比如一个sli的raid卡:
root@test:~ # diskinfo -v mfisyspd0
mfisyspd0
512 # sectorsize
500107862016 # mediasize in bytes (465G)
976773168 # mediasize in sectors
0 # stripesize
0 # stripeoffset
60801 # Cylinders according to firmware.
255 # Heads according to firmware.
63 # Sectors according to firmware.
# Disk ident.
Disk ident栏为空,用camcontrol也同样读不出来。
可以使用专用工具来查看,比如sli卡的工具是MegaCli(注意大小写):
root@test:~ # MegaCli -PDList -a0
Adapter #0
Enclosure Device ID: 62
Slot Number: 0
Enclosure position: N/A
Device Id: 2
WWN: 5000C500558E8D3C
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 465.761 GB [0x3a386030 Sectors]
Non Coerced Size: 465.261 GB [0x3a286030 Sectors]
Coerced Size: 465.25 GB [0x3a280000 Sectors]
Firmware state: JBOD
Device Firmware Level: BD2C
Shield Counter: 0
Successful diagnostics completion on : N/A
SAS Address(0): 0x5000c500558e8d3d
SAS Address(1): 0x0
Connected Port Number: 0(path0)
Inquiry Data: IBM-ESXSST9500620SS BD2C9XF1YPHK0806BD2C
IBM FRU/CRU: 90Y8954
FDE Capable: Not Capable
……(后面还有一大堆)
结果:上文倒数第三行Inquiry Data有两段或三段,最后一段就是磁盘序列号——ibm就是牛,弄个磁盘序列号都比其他厂家长!
另:好好的排版,被网页编辑器给弄乱了%%%
该贴被wulcan编辑于2015-7-25 10:29:03