Linux RHEL how to differentiate between a local disk and a SAN disk

hard drivelinuxstorage

I have a server with several disks and partitions. For an specific disk I want to know if it is local or in the SAN.

I ran some commands:

[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

How can I certainly know which device is local and which is connected to the SAN?

Best Answer

There's a couple different approaches you can take. Some may be better or worse for your particular setup. Remember, strictly speaking a Fibre Channel drives does not necessarily mean "SAN" or "Storage Array". It may just be an actual FC-attached drive.


You can check to see which SCSI host the drive is on and filter that way if you know, for example, that all your servers have (i.e) QLogic cards:

# 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

Check the di VPD page for the device in question to see what protocol it's using.

# 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

Check using the path management tools for your particular storage array to see if the device is on that array. For example:

# 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

versus:

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