How to differentiate between local and SAN storage?

By looking at fdisk -l output you cannot know whether, for example, /dev/sda is locally attached disk or is it available from SAN.

# fdisk -l                                                                                                                 

Disk /dev/sda: 200.0 GB, 200000143360 bytes
255 heads, 63 sectors/track, 24315 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       24315   195310206   83  Linux 

Disk /dev/sdb: 2000 MB, 2000683008 bytes
62 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 3844 * 512 = 1968128 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1016     1952721   83  Linux 

Disk /dev/sdc: 140.0 GB, 140000624640 bytes
255 heads, 63 sectors/track, 17020 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       17020   136713118+  83  Linux 

Disk /dev/sdd: 400.0 GB, 400000286720 bytes
255 heads, 63 sectors/track, 48630 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       48630   390620443+  83  Linux 

Disk /dev/sde: 2857.7 GB, 2857795321856 bytes
255 heads, 63 sectors/track, 347440 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1      267349  2147480811   83  Linux
/dev/sde2          267350      347440   643330957+  83  Linux

Disk /dev/sdf: 899.9 GB, 899949789184 bytes
255 heads, 63 sectors/track, 109412 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1      109412   878851858+  83  Linux

Disk /dev/sdg: 599.9 GB, 599965827072 bytes
255 heads, 63 sectors/track, 72941 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1       72941   585898551   83  Linux

Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes
255 heads, 63 sectors/track, 17844 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
/dev/cciss/c0d0p1   *           1          13      104391   83  Linux
/dev/cciss/c0d0p2              14       17844   143227507+  8e  Linux LVM

Disk /dev/cciss/c0d1: 146.7 GB, 146778685440 bytes
255 heads, 32 sectors/track, 35132 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes

Disk /dev/cciss/c0d1 doesn't contain a valid partition table

But, you can compare fdisk output with the contents of sysfs virtual filesystem which exports information about devices and drivers, for example:

# ls -l /sys/block/*/device
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/cciss!c0d0/device -> ../../devices/pci0000:00/0000:00:03.0/0000:06:00.0/disk0
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/cciss!c0d1/device -> ../../devices/pci0000:00/0000:00:03.0/0000:06:00.0/disk1
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/hda/device -> ../../devices/pci0000:00/0000:00:1f.1/ide0/0.0
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/sda/device -> ../../devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:00.0/0000:0b:00.0/host0/target0:0:1/0:0:1:1
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/sdb/device -> ../../devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:00.0/0000:0b:00.0/host0/target0:0:1/0:0:1:2
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/sdc/device -> ../../devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:00.0/0000:0b:00.0/host0/target0:0:1/0:0:1:3
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/sdd/device -> ../../devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:00.0/0000:0b:00.0/host0/target0:0:1/0:0:1:4
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/sde/device -> ../../devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:00.0/0000:0b:00.0/host0/target0:0:1/0:0:1:5
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/sdf/device -> ../../devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:00.0/0000:0b:00.0/host0/target0:0:1/0:0:1:6
lrwxrwxrwx 1 root root 0 Jun 20 14:58 /sys/block/sdg/device -> ../../devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:00.0/0000:0b:00.0/host0/target0:0:1/0:0:1:7

So, in this output I see that /dev/cciss/c0d0 and /dev/cciss/c0d1 are local drives (cciss is a driver for HP’s Smart Array disk controllers), /dev/hda is probably mapped to my CD-ROM device, and /dev/sd[a-g] are exports from SAN storage (note the host0 and target0).

Comments are closed.