问题
如果配置了raid,在系统层面看到的是/dev/sdb这样的设备,那这个设备对应到后台的物理磁盘是什么品牌的,具体到哪块设备,这个怎么查找
这个问题的来源是这样的,我有个/dev/sdb 我不清楚这个ssd是什么品牌的,我想用smartcl去查看这个磁盘的状态,但是过了raid以后无法直接查,需要用raid的编号查,但是又不清楚/dev/sdb与哪个raid对应,所以需要把这几个关系关联起来,那么下面的几个命令就是把这个关系查询到
方法
获取id
[root@lab101 ~]# lsscsi
[0:2:0:0] disk Intel RMS25CB080 3.40 /dev/sda
[0:2:1:0] disk Intel RMS25CB080 3.40 /dev/sdb
[0:2:2:0] disk Intel RMS25CB080 3.40 /dev/sdc
[0:2:3:0] disk Intel RMS25CB080 3.40 /dev/sdd
[0:2:4:0] disk Intel RMS25CB080 3.40 /dev/sde
[0:2:5:0] disk Intel RMS25CB080 3.40 /dev/sdf
[0:2:6:0] disk Intel RMS25CB080 3.40 /dev/sdg
最左边的就是编号,对应到下一步里面的target id
[root@lab101 ~]# /opt/megaraid/megacli -LdPdInfo -a0 -NoLog|grep "Target Id|Inquiry Data|Raw|Device Id"
Virtual Drive: 0 (Target Id: 0)
Device Id: 17
Raw Size: 223.570 GB [0x1bf244b0 Sectors]
Inquiry Data: S1RGNWAG200638X Samsung SSD 845DC EVO 240GB EXT03X3Q
Virtual Drive: 1 (Target Id: 1)
Device Id: 19
Raw Size: 238.474 GB [0x1dcf32b0 Sectors]
Inquiry Data: G12855R000065 FORESEE 256GB SSD N0530A
Virtual Drive: 2 (Target Id: 2)
Device Id: 18
Raw Size: 238.474 GB [0x1dcf32b0 Sectors]
Inquiry Data: G12855R000055 FORESEE 256GB SSD N0530A
Virtual Drive: 3 (Target Id: 3)
Device Id: 15
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Inquiry Data: ZC11HNSWST4000NM0035-1V4107 TN02
Virtual Drive: 4 (Target Id: 4)
Device Id: 20
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Inquiry Data: S1Z1H20JST4000NM0033-9ZM170 SN04
Virtual Drive: 5 (Target Id: 5)
Device Id: 12
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Inquiry Data: ZC11KJ9JST4000NM0035-1V4107 TN02
Virtual Drive: 6 (Target Id: 6)
Device Id: 13
Raw Size: 3.638 TB [0x1d1c0beb0 Sectors]
Inquiry Data: S1Z1G9K2ST4000NM0033-9ZM170 SN04
上面有个Device Id,对应到下面的megaraid后面的id
[root@lab101 ~]# smartctl --scan
/dev/sda -d scsi # /dev/sda, SCSI device
/dev/sdb -d scsi # /dev/sdb, SCSI device
/dev/sdc -d scsi # /dev/sdc, SCSI device
/dev/sdd -d scsi # /dev/sdd, SCSI device
/dev/sde -d scsi # /dev/sde, SCSI device
/dev/sdf -d scsi # /dev/sdf, SCSI device
/dev/sdg -d scsi # /dev/sdg, SCSI device
/dev/bus/0 -d megaraid,12 # /dev/bus/0 [megaraid_disk_12], SCSI device
/dev/bus/0 -d megaraid,13 # /dev/bus/0 [megaraid_disk_13], SCSI device
/dev/bus/0 -d megaraid,15 # /dev/bus/0 [megaraid_disk_15], SCSI device
/dev/bus/0 -d megaraid,17 # /dev/bus/0 [megaraid_disk_17], SCSI device
/dev/bus/0 -d megaraid,18 # /dev/bus/0 [megaraid_disk_18], SCSI device
/dev/bus/0 -d megaraid,19 # /dev/bus/0 [megaraid_disk_19], SCSI device
/dev/bus/0 -d megaraid,20 # /dev/bus/0 [megaraid_disk_20], SCSI device
我们看下sn
[root@lab101 ~]# smartctl -a /dev/bus/0 -d megaraid,19|grep Serial
Serial Number: G12855R000065
可以看到关系对应上了
总结一下路径
1、查到 [0:2:1:0] disk Intel RMS25CB080 3.40 /dev/sdb
2、根据上面的查到
Virtual Drive: 1 (Target Id: 1)
Device Id: 19
Raw Size: 238.474 GB [0x1dcf32b0 Sectors]
Inquiry Data: G12855R000065 FORESEE 256GB SSD N0530A
3、根据上面的查到
/dev/bus/0 -d megaraid,19 # /dev/bus/0 [megaraid_disk_19], SCSI device
然后执行查询
smartctl -a /dev/bus/0 -d megaraid,19