1,操作系统:centos或redhat
2,查看scsi设备到/dev/sd的映射
# ll /dev/disk/by-path/
total 0
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2014-10-30 18:37 pci-0000:02:00.0-scsi-0:2:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:0:0-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:0:0-part5 -> ../../sda5
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:1:0 -> ../../sdb
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:10:0 -> ../../sdk
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:2:0 -> ../../sdc
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:3:0 -> ../../sdd
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:4:0 -> ../../sde
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:5:0 -> ../../sdf
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:6:0 -> ../../sdg
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:7:0 -> ../../sdh
lrwxrwxrwx 1 root root 9 2014-10-30 12:38 pci-0000:02:00.0-scsi-0:2:8:0 -> ../../sdi
lrwxrwxrwx 1 root root 9 2014-11-03 17:08 pci-0000:02:00.0-scsi-0:2:9:0 -> ../../sdj
以pci-0000:02:00.0-scsi-0:2:9:0 -> ../../sdj为例进行分析:
0:2:9:0分别表示:
PCI identifier of the host bus adapter (HBA)
channel number on that HBA
the remote SCSI target address(Target Id)
the Logical Unit Number (LUN)
This path-based address is not persistent. It may change any time the system is reconfigured (either by on-line reconfiguration, as described in this manual, or when the system is shutdown, reconfigured, and rebooted). It is even possible for the path identifiers to change when no physical reconfiguration has been done, as a result of timing variations during the discovery process when the system boots, or when a bus is re-scanned.
The operating system provides several non-persistent names to represent these access paths to storage devices. One is the /dev/sd name; another is the major:minor number. A third is a symlink maintained in the /dev/disk/by-path/ directory. This symlink maps from the path identifier to the current /dev/sd name.
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/persistent_naming.html
3,通过Megcli查看target ID来和/dev/sd对应上
# MegaCli64 -cfgdsply -aALL|grep ‘Target‘
Virtual Drive: 0 (Target Id: 0)
Virtual Drive: 1 (Target Id: 1)
Virtual Drive: 2 (Target Id: 2)
Virtual Drive: 4 (Target Id: 4)
Virtual Drive: 5 (Target Id: 5)
Virtual Drive: 6 (Target Id: 6)
Virtual Drive: 7 (Target Id: 7)
Virtual Drive: 8 (Target Id: 8)
Virtual Drive: 9 (Target Id: 9)
Virtual Drive: 10 (Target Id: 10)
Virtual Drive: 3 (Target Id: 3)
这样的话,如果我们通过Megcli查到有坏道需要维修更换的磁盘,我们就能知道对应的/dev/sd的设备是哪一个了