Login or register    

How to determine if a device is Local or SAN in Linux

I'm just going to list a bunch of safe commands you can run to probe the system to determine what you are working with.

lsscsi

lsscsi
list scsi
[root@server]# lsscsi
[0:0:0:0]    disk    IBM-ESXS ST973452SS       B623  -
[0:0:1:0]    disk    IBM-ESXS ST973452SS       B623  -
[0:1:3:0]    disk    LSILOGIC Logical Volume   3000  /dev/sda
[3:0:0:0]    disk    3PARdata VV               0000  /dev/sdb
[5:0:0:0]    disk    3PARdata VV               0000  /dev/sdc

[root@server]# lsscsi -H
[0]    mptsas
[1]    ata_piix
[2]    ata_piix
[3]    <NULL>
[4]    <NULL>
[5]    <NULL>
[6]    <NULL>

[root@server]# lsscsi -g
[0:0:0:0]    disk    IBM-ESXS ST973452SS       B623  -         /dev/sg0
[0:0:1:0]    disk    IBM-ESXS ST973452SS       B623  -         /dev/sg1
[0:1:3:0]    disk    LSILOGIC Logical Volume   3000  /dev/sda  /dev/sg2
[3:0:0:0]    disk    3PARdata VV               0000  /dev/sdb  /dev/sg3
[5:0:0:0]    disk    3PARdata VV               0000  /dev/sdc  /dev/sg4

ls /dev/disk

[root@server]# ls -hal /dev/disk/by-path/
total 0
drwxr-xr-x 2 root root 180 Jan 11  2012 .
drwxr-xr-x 6 root root 120 Jan 11  2012 ..
lrwxrwxrwx 1 root root   9 Jan 11  2012 ide-0:0 -> ../../hda
lrwxrwxrwx 1 root root   9 Jan 11  2012 pci-0000:04:00.0-scsi-0:1:3:0 -> ../../sda
lrwxrwxrwx 1 root root  10 Jan 11  2012 pci-0000:04:00.0-scsi-0:1:3:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root  10 Jan 11  2012 pci-0000:04:00.0-scsi-0:1:3:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root  10 Jan 11  2012 pci-0000:04:00.0-scsi-0:1:3:0-part3 -> ../../sda3
lrwxrwxrwx 1 root root   9 Jan 11  2012 pci-0000:06:00.0-fc-0x21110002ac0008b4:0x0000000000000000 -> ../../sdc
lrwxrwxrwx 1 root root   9 Jan 11  2012 pci-0000:2a:00.0-fc-0x20110002ac0008b4:0x0000000000000000 -> ../../sdb
[root@server]# ls -hal /dev/disk/by-id/
total 0
drwxr-xr-x 2 root root 140 Jan 11  2012 .
drwxr-xr-x 6 root root 120 Jan 11  2012 ..
lrwxrwxrwx 1 root root   9 Jan 11  2012 scsi-350002ac0343408b4 -> ../../sdb
lrwxrwxrwx 1 root root   9 Jan 11  2012 scsi-3600508e000000000cbd00903176ab80b -> ../../sda
lrwxrwxrwx 1 root root  10 Jan 11  2012 scsi-3600508e000000000cbd00903176ab80b-part1 -> ../../sda1
lrwxrwxrwx 1 root root  10 Jan 11  2012 scsi-3600508e000000000cbd00903176ab80b-part2 -> ../../sda2
lrwxrwxrwx 1 root root  10 Jan 11  2012 scsi-3600508e000000000cbd00903176ab80b-part3 -> ../../sda3

blkid

[root@server]# blkid
/dev/mapper/vg00-lv02: UUID="520d3a30-a118-4373-a190-7c6cbfc341df" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/vg00-lv03: UUID="1de15bdc-e56c-4ae1-98c6-9b4508675225" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/vg00-lv04: UUID="0e7d6223-689b-4f0d-b24d-3b89fe07ea63" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/vg00-lv06: UUID="b92c1864-a23b-4b5f-ba4b-5672b279c200" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/vg00-lv05: UUID="5f8cf0b5-aae1-4aaa-bf4c-fc64b3a0f499" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/vg00-lv01: UUID="fd84dcfb-c2b6-4848-b26f-77714313729b" SEC_TYPE="ext2" TYPE="ext3"
/dev/vg00/lv01: UUID="fd84dcfb-c2b6-4848-b26f-77714313729b" SEC_TYPE="ext2" TYPE="ext3"
/dev/fioa1: UUID="afd10bb6-d937-4bf7-bc2c-dcd7ff256fe9" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/vg01-lvol0: UUID="75aaa9e7-33b8-4037-a919-33ff57662136" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda1: LABEL="/boot" UUID="4a68f1c6-ad6c-40fb-a0b9-083931ae5ec4" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda2: LABEL="SWAP-sda2" TYPE="swap"
/dev/md0: UUID="afd10bb6-d937-4bf7-bc2c-dcd7ff256fe9" SEC_TYPE="ext2" TYPE="ext3"
/dev/fiob1: UUID="afd10bb6-d937-4bf7-bc2c-dcd7ff256fe9" SEC_TYPE="ext2" TYPE="ext3"

multipath

[root@server]# multipath -l
mpath0 (350002ac0343408b4) dm-6 3PARdata,VV
[size=100G][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:0:0 sdb 8:16  [active][undef]
 \_ 5:0:0:0 sdc 8:32  [active][undef]

 # also look at multipath -v3

check for multipath software

  • Does /etc/multipath.conf exist?

  • On redhat / fedora / centos run the following command and review any output:

    [root@server]# rpm -qa | grep multip
    device-mapper-multipath-0.4.7-17.el5
    
  • On debian / ubuntu run the following command and review any output:

    [root@server]# sudo dpkg --get-selections | grep multip
    multipath-tools                                 install
    

df and lvm

Use df to learn about currently mounted devices, select an interesting mount and investigate:

[root@server]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
...
/dev/mapper/vg01-lvol0
                     103208224  46826088  51139464  48% /disk1
...

Determine which volume group this this logical volume is part of:

[root@server]# lvm lvdisplay /dev/mapper/vg01-lvol0
 --- Logical volume ---
 LV Name                /dev/vg01/lvol0
 VG Name                vg01
 LV Size                100.00 GB
 ...

Determine which physical volume this volume group (vg01) is part of:

[root@server]# lvm pvdisplay
 --- Physical volume ---
 PV Name               /dev/dm-6
 VG Name               vg01
 PV Size               100.00 GB / not usable 4.00 MB
 ...

Look closer at /dev/mpath:

[root@server]# ls -hal /dev/mpath
total 0
drwxr-xr-x  2 root root   60 Jan 11  2012 .
drwxr-xr-x 15 root root 4.0K Mar 22 08:11 ..
lrwxrwxrwx  1 root root    7 Jan 11  2012 350002ac0343408b4 -> ../dm-6

350002ac0343408b4 relates to the following:

[root@server]# multipath -l
mpath0 (350002ac0343408b4) dm-6 3PARdata,VV
[size=100G][features=1 queue_if_no_path][hwhandler=0]
\_ round-robin 0 [prio=0][active]
 \_ 3:0:0:0 sdb 8:16  [active][undef]
 \_ 5:0:0:0 sdc 8:32  [active][undef]

3PARdata is not local, its a SAN.

Comments

Leave a comment

Please login or register to leave a comment!