use lun storage

multipathd

  1. first install multipathd
    yum install device-mapper-multipath
  2. copy multipath.conf in /etc or use multipath -t >/etc/multipath.conf
  3. restart multipathd
    service multipathd restart
  4. alias in multipath.conf
    multipaths {
        multipath {
            wwid 360000970000296800677533030303638
            alias fsilun
        }
    }
  5. reload multipathd
    service multipathd reload
  6. multipathd on startup
    chkconfig multipathd on

scan luns

  1. look for fc hosts
    ls /sys/class/fc_host

    e.g. you get two: host0 host1

  2. install rescan script
    yum install sg3_utils
  3. to rescan luns
    rescan-scsi-bus.sh

    or

    echo "1" > /sys/class/fc_host/host0/issue_lip
    echo "- - -" > /sys/class/scsi_host/host0/scan

    for all hosts you find (hba controller)

multipath

  1. show
    multipath -ll

    e.g. you get following output

    fsilun (360000970000296800677533030303638) dm-1 EMC,SYMMETRIX
    size=1000G features='1 queue_if_no_path' hwhandler='0' wp=rw
    `-+- policy='round-robin 0' prio=1 status=active
      |- 1:0:1:1 sdd 8:48 active ready running
      |- 2:0:1:1 sdf 8:80 active ready running
      |- 1:0:0:1 sdc 8:32 active ready running
      `- 2:0:0:1 sde 8:64 active ready running

Example:

A server node with 2 * fibre channel HBAs attached to a storage controller with 2 ports sees 4 devices: /dev/sda, /dev/sdb, dev/sdc, and /dev/sdd.

Device Mapper (DM) Multipath creates a single device with a unique World Wide Identifier (WWID) that reroutes I/O to those four underlying devices according to the multipath configuration.

device mapper

  1. create block device in /dev/mapper with fsilun as name
  2. wipe to create new fresh physical volume
    dd if=/dev/zero of=/dev/mapper/fsilun bs=512 count=1

lvm

  1. create physical volume
    pvcreate /dev/mapper/fsilun
    File descriptor 7 (pipe:[13154434]) leaked on pvcreate invocation. Parent PID 3865: bash
      Physical volume "/dev/mapper/fsilun" successfully created
    • show pyhsical volume
      pvdisplay
  2. wipe sector, so the lun is clean
    dd if=/dev/zero of=/dev/mapper/fsilun bs=512 count=1
    1+0 records in
    1+0 records out
    512 bytes (512 B) copied, 0.000873947 s, 586 kB/s
  3. create volume group
    vgcreate fsilun /dev/mapper/fsilun
    File descriptor 7 (pipe:[13154434]) leaked on pvcreate invocation. Parent PID 3865: bash
      Physical volume "/dev/mapper/fsilun" successfully created
    • show volume group
      vgdisplay
  4. create logical volume (-L <size in PE see above)
    lvcreate -L 256000 -n lvfsilun fsilun
    File descriptor 7 (pipe:[13154434]) leaked on lvcreate invocation. Parent PID 3865: bash
      Logical volume "lvfsilun" created.
    • show logical volume
      lvdisplay

format filesystem

  1. create ext4 filesystem
    mkfs.ext4 /dev/fsilun/lvfsilun
    mke2fs 1.41.12 (17-May-2010)
    Discarding device blocks: done
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    16384000 inodes, 65536000 blocks
    3276800 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=4294967296
    2000 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624, 11239424, 20480000, 23887872
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    This filesystem will be automatically checked every 34 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.

mount

  1. create mount dir
    mkdir /mnt/fsilun
  2. mount
    mount -t ext4 /dev/fsilun/lvfsilun /mnt/fsilun/


    Authors:
    • Jochen Schnuerle