SAN Storage configuration has two main parts: detecting the storage disks (provided that the HBA driver is installed, or at least Linux detects them automatically), and configuring multipathing to avoid disks being renamed after every reboot.
First, disks detection:
1. If you are using SAN storage disk (HP, EMC, …etc), create the disk LUNs from the storage side.
2. From Linux, check if HBA is recognized as hardware:
# lspci (look for Fiber Channel word, or Qlogic, …etc).
3. Scan the new disk LUNs.
# echo “1” > /sys/class/fc_host/host0/issue_lip
# echo “- – -” > /sys/class/scsi_host/host0/scan
# echo “1” > /sys/class/fc_host/host1/issue_lip
# echo “- – -” > /sys/class/scsi_host/host1/scan
Another way of rescanning the LUNs:
# yum install sg3_utils*
4. Check if paths are recognized
# ls –lrt /sys/class/fc_host/host*/port_name
5. Make sure all disks appear in the Linux devices. Each disk with its different path
# ls -la /dev/disk/by-path/*
6. Check if disks are shown/recognized. Again, they might be the same disk, but due to the different paths, you would see them multiple times.
# fdisk –l
7. Other helpful commands to see the detected disks:
Second: multipath configuration:
8. Since most of storage configurations have multiple paths to disks (example: dual SAN switches, where each SAN switch has dual fiber connections to storage, which results in 4 paths, and so on).
Therefore, you need to configure the multipathing on the newly installed server. Otherwise, each disk path will be represented as a new disk (e.g. /dev/sda for first path, /dev/sdb for the second path… and /dev/sdd for the fourth path). These multi paths to the same disk may create a problem during reboots, since /dev/sda might be recognized as /dev/sdb after a reboot, depending on the order Linux detects these disks. For this reason, you need to create the multiapath device, which is a fixed device that contains all different paths to this physical disk.
If the storage vendor does not provide its own (for example, PowerPath from EMC), then you do it yourself using the native multipath package from Linux, as follows:
a. Start the multipath service
# service multipathd start
# chkconfig multipathd on
b. Edit /etc/multipath.conf, and blacklist the local disks, local LVMs, …etc.
devnode “^vg*” //to block local LVM disks
devnode “^cciss*” //to block HP local disks
c. See which disks are recognized
# multipath –v3
d. Get the SAN device manufacturer and model
# cat /sys/block/sda/device/vendor
# cat /sys/block/sda/device/model
e. Enter these information in the /etc/multipath.conf file
# vim /etc/multipath.conf
f. Get the disk unique WWID
# cat /var/lib/multipath/bindings
g. Enter the WWID in the /etc/multipath.conf file
# vim /etc/multipath.conf
path_selector “round-robin 0”
h. Show configured multipath
# dmsetup ls –target=multipath
# multipath -ll
i. Format the multipath device
# mkfs.ext3 /dev/mapper/mpath0p1
Linux SAN Multipathing