Tuesday 3 September 2013

Setting up multipath and mount disk on linux Redhat 5/6




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
The above command is no longer working on redhat 6.
Install Multipath if not install:

[root@admin ~]# yum install device-mapper-multipath
 
2    Launch modules and add service to startup
[root@admin ~]# modprobe dm-multipath
[root@admin ~]#  service multipathd start
[root@admin ~]#  chkconfig multipathd on

3     Now I have the WWN’s i can add them to my multipath config (/etc/multipathd.conf)
If it daesn’t exist please run :
 [root@admin ~]# /sbin/mpathconf
[root@admin ~]# cp /etc/multipath/.multipath.conf.tmp /etc/multipath.conf
Discover multipath devices :

[root@SVR-IDORA-01 data]# multipath
J
Jul 20 11:02:42 | DM message failed [queue_if_no_path
]
create: mpathc (3600c0ff00010341f7f56fc4f01000000) undef HP,MSA2312fc
size=466G features='0' hwhandler='0' wp=undef
|-+- policy='round-robin 0' prio=50 status=undef
| |- 3:0:0:6 sdr 65:16 undef ready  running
| `- 3:0:1:6 sds 65:32 undef ready  running
`-+- policy='round-robin 0' prio=10 status=undef
  |- 3:0:2:6 sdt 65:48 undef ready  running
  `- 3:0:3:6 sdu 65:64 undef ready  running
[root@SVR-IDORA-01 data]# multipath  -l
mpathc (3600c0ff00010341f7f56fc4f01000000) dm-0 HP,MSA2312fc
size=466G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=-1 status=active
| |- 3:0:0:6 sdr 65:16 active undef running
| `- 3:0:1:6 sds 65:32 active undef running
`-+- policy='round-robin 0' prio=-1 status=enabled
  |- 3:0:2:6 sdt 65:48 active undef running
  `- 3:0:3:6 sdu 65:64 active undef running
       Edit /etc/ multipathd.conf  and paste the configuration below :
defaults {
         user_friendly_names yes
}
 multipaths {
       multipath {
             wwid                3600c0ff00010341f7f56fc4f01000000   (donné par multipath)
             alias               dborapart (pour designer le device multipath)
             path_grouping_policy multibus
             path_checker        readsector0
             path_selector       "round-robin 0"
             failback            manual
             rr_weight           priorities
             no_path_retry       5
       }}
} 
Now i have the default configuration
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
5 
          Now you can see your new volume, in this case /dev/dm-3, sometime in Redhat 6 you’ll see “mpath” follow by a, b or c depending on the number of volume.
Create new partition (do these  steps if you can restart  your server or go to step 6) :
[root@admin ~]# fdisk /dev/dm-3 or /dev/mapper/mpathb
Next type “n” and (press enter)
Choose “p” option then press enter.
Choose “1” partition and press enter 3 times
Finally type “w” to write changes.

On linux you need to restart the OS to apply the change to the table of partition.

[root@admin ~]# fdisk –l
You’ll see new partitions like /dev/mapper/mpathbp1 or /dev/dm-3p1
6     once the new partition is created you can create filesystem
[root@admin ~]# mkfs.ext3 /dev/dm-3p1
and finally mount your volume somewhere
[root@admin ~]# mount /dev/dm-3p1 /mnt/myvolume

No comments:

Post a Comment

HOWTO IMPORT OVA (from VMware) to PROXMOX 5.x

  HOWTO IMPORT OVA (from VMware) to PROXMOX 5.x         Hi All may be someone has faced to import an OVA (created with VMware) to PROX...