我正在尝试获取连接到 Centos 服务器的磁盘的磁盘序列号。当没有 raid0(在 LSI 下)时,我可以/dev/sdb
通过以下方式获取序列号和型号:
smartctl -i /dev/sdb
输出为:
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-431.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
disk Model: WDC WD4000FYYZ-01UL1B2
Serial Number: WD-WMC130D3PEZ4
LU WWN disk Id: 5 0014ee 0ae93b565
Firmware Version: 01.01K03
User Capacity: 4,000,787,030,016 bytes [4.00 TB]
Sector Size: 512 bytes logical/physical
disk is: Not in smartctl database [for details use: -P showall]
ATA Version is: 8
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Mon Apr 13 15:09:29 2015 CST
SMART support is: Available - disk has SMART capability.
SMART support is: Enabled
但到了/dev/sdb
raid0后面,输出就变成:
# smartctl -i /dev/sdb
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-431.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
Vendor: LSI
Product: LSI
Revision: 3.19
User Capacity: 2,999,999,004,672 bytes [2.99 TB]
Logical block size: 512 bytes
Logical Unit id: 0x6234567890abcde01b73bdde67c081d1
Serial number: 00d181c067debd731be0cdab90785634
Device type: disk
Local Time is: Fri Apr 17 17:05:47 2015 CST
Device does not support SMART
而且Serial number
磁盘规格上没有标注真正的序列号,所以没法使用。另外我增加了几个smartctl的参数:
smartctl -i -d sat+megaraid,N /dev/sdb
这里的非负整数N
(在 0 到 127 范围内)表示监视控制器上的哪个磁盘,我可以得到真实的序列号(另一个磁盘,而不是之前提到的那个):
# smartctl -i -d sat+megaraid,0 /dev/sda
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-431.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Device Model: ST3000NM0033-9ZM178
Serial Number: Z1Z40MVG
LU WWN Device Id: 5 000c50 066d78a8b
Firmware Version: SN02
User Capacity: 3,000,592,982,016 bytes [3.00 TB]
Sector Size: 512 bytes logical/physical
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 8
ATA Standard is: ACS-2 (revision not indicated)
Local Time is: Fri Apr 17 17:12:57 2015 CST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
问题 1
但是当我(仅)将其更改/dev/sda
为/dev/sdb
或存在任何其他设备时,输出是相同的,这是一个错误吗?
问题2
容量/dev/sda
只有278.5G:
# lsblk /dev/sda -io name,size -d
NAME SIZE
sda 278.5G
但是当我运行的时候smartctl -i -d sat+megaraid,0 /dev/sda
,的输出User Capacity
是 3TB,而不是真正的磁盘容量,并且插槽标签到 N 之间没有严格的映射(至少现在),但如果/dev/sd*
不存在,smartctl
则会失败:
Smartctl open device: /dev/sdx [megaraid_disk_12] [SAT] failed: No such device
看起来 smartctl 只检查磁盘的存在。
我有 13 个磁盘(包括系统磁盘),如何获取N
和之间的严格映射关系/dev/sd*
?
问题 3
我想获取最后一个序列号并运行smartctl -i -d sat+megaraid,12 /dev/sda
,但输出是:
smartctl 5.43 2012-06-30 r3573 [x86_64-linux-2.6.32-431.el6.x86_64] (local build)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net
Smartctl: Device Read Identity Failed: megasas_cmd result: 0.12 = 0/45
A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.
这里是什么0.12 = 0/45
意思?