存储 – 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?

解决方法

你可以采取几种不同的方法.对于您的特定设置,有些可能更好或更差.请记住,严格来说,光纤通道驱动器并不一定意味着“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)

相关文章

Linux中的ARP防火墙主要用于防御ARP欺骗攻击,其效果取决于多...
insmod和modprobe加-f参数导致Invalid module format错误 这...
将ArchLinux安装到U盘 几个月前入门Arch的时候上网搜了不少安...
1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...