Linux RHEL 如何区分本地磁盘和 SAN 磁盘

Linux RHEL 如何区分本地磁盘和 SAN 磁盘

我有一台带有多个磁盘和分区的服务器。对于特定磁盘,我想知道它是本地磁盘还是 SAN 磁盘。

我运行了一些命令:

[root@server]# ls -l /sys/block/*/device
lrwxrwxrwx  1 root root 0 Jul 22 12:15 /sys/block/hda/device -> ../../devices/pci0000:00/0000:00:1f.1/ide0/0.0
lrwxrwxrwx  1 root root 0 Jul 22 12:15 /sys/block/sda/device -> ../../devices/pci0000:00/0000:00:03.0/0000:01:00.0/0000:02:0e.0/host0/target0:2:0/0:2:0:0
lrwxrwxrwx  1 root root 0 Jul 22 12:15 /sys/block/sdb/device -> ../../devices/pci0000:00/0000:00:03.0/0000:01:00.0/0000:02:0e.0/host0/target0:2:1/0:2:1:0
lrwxrwxrwx  1 root root 0 Jul 22 12:15 /sys/block/sdc/device -> ../../devices/platform/host3/target3:0:0/3:0:0:0

我如何才能确切地知道哪个设备是本地的、哪个设备连接到 SAN?

答案1

您可以采取几种不同的方法。有些方法可能对您的特定设置更好或更坏。请记住,严格来说,光纤通道驱动器并不一定意味着“SAN”或“存储阵列”。它可能只是一个实际的 FC 连接驱动器。


您可以检查驱动器位于哪个 SCSI 主机上,并且如果您知道所有服务器都有(即)QLogic 卡,则可以按此方式进行过滤:

# lsscsi -H; lsscsi -g
[0]    qla2xxx       
[1]    qla2xxx       
[2]    mptsas        
[3]    ata_piix      
[4]    ata_piix      
[0:0:0:0]    disk    IBM      1814      FAStT  0916  /dev/sda  /dev/sg0
[0:0:0:1]    disk    IBM      1814      FAStT  0916  /dev/sdb  /dev/sg1
[0:0:0:2]    disk    IBM      1814      FAStT  0916  /dev/sdd  /dev/sg3
[0:0:0:31]   disk    IBM      Universal Xport  0916  -         /dev/sg4
[1:0:0:0]    disk    IBM      1814      FAStT  0916  /dev/sdc  /dev/sg2
[1:0:0:1]    disk    IBM      1814      FAStT  0916  /dev/sde  /dev/sg5
[1:0:0:2]    disk    IBM      1814      FAStT  0916  /dev/sdf  /dev/sg6
[1:0:0:31]   disk    IBM      Universal Xport  0916  -         /dev/sg7

检查di相关设备的 VPD 页面以查看其使用的协议。

# sg_vpd -p di /dev/sda
Device Identification VPD page:
  Addressed logical unit:
    designator type: NAA,  code_set: Binary
      0x600a0b80002664e2000026c349dda1ee
  Target port:
    designator type: NAA,  code_set: Binary
     transport: Fibre Channel (FCP-2)
      0x200600a0b8266f7f
    designator type: Relative target port,  code_set: Binary
     transport: Fibre Channel (FCP-2)
      Relative target port: 0x1
  Target device that contains addressed lu:
    designator type: NAA,  code_set: Binary
     transport: Fibre Channel (FCP-2)
      0x200600a0b8266f7e

使用特定存储阵列的路径管理工具检查该设备是否在该阵列上。例如:

# sg_rdac /dev/sda
RDAC Legacy page
  Controller serial: 1T63717016
  Alternate controller serial: 1T64109650
  RDAC mode (redundant processor): alternate controller present; Dual active mode
  RDAC mode (alternate processor): alternate controller present; Dual active mode
  Quiescence timeout: 75
  RDAC option 0x6
  LUN Table:
    0: a a x x x x x x
    1: x x x x x x x x
    2: x x x x x x x x
    3: x x x x x x x x

相对:

# sg_rdac /dev/sda
invalid field in cdb (perhaps subpages or page control (PC) not supported)

答案2

SAN LUN 不会表现为 IDE 驱动器。

相关内容