CentOS fibre channel multipath


1.
On the machine where you want to setup multipath you first need to find the WWN’s of the FC cards:

[root@admin ~]# cat /sys/class/scsi_host/host*/device/fc_host*/port_name
0x50014380029d41dc
0x50014380029d40b8
2.
Now I have the WWN’s i can add them to my multipath config  (/etc/multipathd.conf)
blacklist {
devnode "*"
}

blacklist_exceptions {
devnode "^sd[b-z].*"
}

defaults {
udev_dir                /dev
polling_interval        5
selector                "round-robin 0"
path_grouping_policy    failover
getuid_callout          "/sbin/scsi_id -g -u -s /block/%n"
prio_callout            /bin/true
path_checker            readsector0
rr_min_io               100
max_fds                 8192
rr_weight               priorities
failback                immediate
no_path_retry           fail
user_friendly_names     yes
}

multipaths {
multipath {
wwid                    0x50014380029d41dc
alias                   fc1
path_grouping_policy    multibus
path_checker            readsector0
path_selector           "round-robin 0"
failback                manual
rr_weight               priorities
no_path_retry           5
}
multipath {
wwid                    0x50014380029d40b8
alias                   fc2
}
}

3.
Now i have the default configuration I can do a dry run to see what devices would be created:

[root@admin ~]# /sbin/multipath -v2 -d

This will list all the mpath devices that would be created, you should see a line similar to:

: mpath4 (360000000000000000000000000000000)  HP,P2000 G3 FC

This ID can be used to create an alias to your volume:

multipath {
wwid                    360000000000000000000000000000000
alias                   myvolumename
}

Add this to the multipaths section of your multipath.conf file.

4.
Now make sure the multipathd service is on:

[root@admin ~]# chkconfig multipathd on

5.
Then start multipath:

[root@admin ~]# service multipathd start
Starting multipathd daemon

You should now have your multipath volume in /dev/mapper

or visible by doing

[root@admin ~]# fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
64 heads, 32 sectors/track, 152627 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         100      102384   83  Linux
/dev/sda2             101      152627   156187648   8e  Linux LVM

Disk /dev/sdd: 49.9 GB, 49999986688 bytes
64 heads, 32 sectors/track, 47683 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/sdd doesn't contain a valid partition table

Disk /dev/sdh: 49.9 GB, 49999986688 bytes
64 heads, 32 sectors/track, 47683 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/sdh doesn't contain a valid partition table

Disk /dev/sdl: 49.9 GB, 49999986688 bytes
64 heads, 32 sectors/track, 47683 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/sdl doesn't contain a valid partition table

Disk /dev/sdp: 49.9 GB, 49999986688 bytes
64 heads, 32 sectors/track, 47683 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/sdp doesn't contain a valid partition table

Disk /dev/dm-3: 49.9 GB, 49999986688 bytes
255 heads, 63 sectors/track, 6078 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

6.
Now you can see your new volume, in this case /dev/dm-3

Create new partition:

[root@admin ~]# fdisk /dev/dm-3

7.
once the new partition is created you can create filesystem

[root@admin ~]# mkfs.ext3 /dev/dm-3p1

8.
and finally mount your volume somewhere

[root@admin ~]# mount /dev/dm-3p1 /mnt/myvolume