How to Convert existing LV to multipath device in RHEL ?

As part of practice I converted existing disk on which LV was created to multipath device. This was very simple setup created on Oracle Virtualbox may be you can face issues in production environment.

My Lab Setup OS used : RHEL 6.2 64 bit

Step 1 : I have installed below packages for Redhat multipathing.
[root@Node1 lvm]# rpm -qa | grep -i multipath
device-mapper-multipath-0.4.9-46.el6.x86_64
device-mapper-multipath-libs-0.4.9-46.el6.x86_64

Step 2 : I have added below preferred names in lvm.conf file so that multipath devices can be detected on server.

[root@Node1 lvm]# cat /etc/lvm/lvm.conf  | egrep -v “^#|^$|^????#” | egrep -i “preferred_names|filter”
preferred_names = [ “^/dev/mpath/”, “^/dev/mapper/mpath”, “^/dev/[hs]d” ]
filter = [ “a/.*/” ]

Step 3 : Logical volume to which I want to convert is having ext4 file system on top of it and it is currently mounted. I have unmounted that file system and deactivated the volume.

[root@Node1 lvm]# lvchange -an test_vg1/test_lv1

[root@Node1 lvm]# lvs
LV       VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
gfs_lv1  gfs_vg1  -wi-ao 700.00m
  test_lv1 test_vg1 -wi— 500.00m
lv_root  vg_node1 -wi-ao   5.54g
lv_swap  vg_node1 -wi-ao   1.97g

[root@Node1 lvm]# vgchange -an test_vg1
0 logical volume(s) in volume group “test_vg1” now active

Step 4 : I have copied the demo multipath.conf file from below location to the destined one and reloaded the multipath service.

[root@Node1 lvm]# cp -p /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf /etc/multipath.conf

[root@Node1 lvm]# /etc/init.d/multipathd restart
Stopping multipathd daemon:                                [  OK  ]
Starting multipathd daemon:                                [  OK  ]

Step 5 : Issued below command to check the status of multipath devices.
[root@Node1 lvm]# multipath -ll
mpathe (1ATA     VBOX HARDDISK                           VB8df06702-9ab) dm-5 ATA,VBOX HARDDISK
size=1.0G features=’0′ hwhandler=’0′ wp=rw
`-+- policy=’round-robin 0′ prio=1 status=active
`- 6:0:0:0 sde 8:64 active ready running
mpathd (1ATA     VBOX HARDDISK                           VB8bf72b41-9e7) dm-4 ATA,VBOX HARDDISK
size=1.0G features=’0′ hwhandler=’0′ wp=rw
`-+- policy=’round-robin 0′ prio=1 status=active
`- 5:0:0:0 sdd 8:48 active ready running
mpathc (1ATA     VBOX HARDDISK                           VBd62986da-408) dm-3 ATA,VBOX HARDDISK
size=1.0G features=’0′ hwhandler=’0′ wp=rw
`-+- policy=’round-robin 0′ prio=1 status=active
`- 4:0:0:0 sdc 8:32 active ready running

[root@Node1 ~]# cd /dev/mapper/
[root@Node1 mapper]# ll mpath*
lrwxrwxrwx 1 root root 7 Oct  1 01:44 mpathc -> ../dm-3
lrwxrwxrwx 1 root root 7 Oct  1 01:44 mpathcp1 -> ../dm-6
lrwxrwxrwx 1 root root 7 Oct  1 01:44 mpathd -> ../dm-4
lrwxrwxrwx 1 root root 7 Oct  1 01:44 mpathe -> ../dm-5

Step 6 : We can check the status with below commands as well and activate our logical volume and can mount it.
[root@Node1 lvm]# pvs
PV                   VG       Fmt  Attr PSize    PFree
/dev/mapper/mpathcp1 test_vg1 lvm2 a–  1016.00m 516.00m
/dev/sda2            vg_node1 lvm2 a–     7.51g      0
/dev/sdb1            gfs_vg1  lvm2 a–  1008.00m 308.00m

[root@Node1 lvm]# lvchange -ay test_vg1/test_lv1

[root@Node1 lvm]# mount -t ext4 /dev/test_vg1/test_lv1 /test

[root@Node1 lvm]# df -h /test
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/test_vg1-test_lv1
485M   11M  449M   3% /test

[root@Node1 lvm]# lvs -oname,devices test_vg1/test_lv1
LV       Devices
test_lv1 /dev/mapper/mpathcp1(0)

References :
https://access.redhat.com/solutions/47894
https://access.redhat.com/solutions/2989

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s