You are on page 1of 6

Overview Linux LVM with

Multipath Enabled

Typical Multipath Connectivity between server and Storage devices

As shown in above diagram, Linux server is connected to SAN Storage with dual
paths (path-1 and path-2). If we map an LUN from SAN Device it will show in
Linux server as two disks because it is coming from two HBA cards (typically two
paths). Here is to combine both the paths and use them as single path
(redundancy).

1|Page
Procedure To Install and configure
Multipath RHEL 7
1. To configure multipath in Linux, we have to install the packages
# yum install -y device-mapper*

2. Verify the installed packages


# rpm -qa |grep device-mapper
device-mapper-persistent-data-0.6.3-1.el7.x86_64
device-mapper-multipath-0.4.9-99.el7.x86_64
device-mapper-libs-1.02.135-1.el7.x86_64
device-mapper-event-1.02.135-1.el7.x86_64
device-mapper-1.02.135-1.el7.x86_64
device-mapper-event-libs-1.02.135-1.el7.x86_64
device-mapper-multipath-libs-0.4.9-99.el7.x86_64

3. Copy the multipath config file from /usr/share/doc/device-mapper-


multipath-0.4.9/multipath.conf location to
/etc/multipath.conf
# cp /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf
/etc/multipath.conf

Or also by the same way to generate using simple multipath command


configuration
# mpathconf --enable --user_friendly_names y

4. Run start, enable and check status multipathd service using below command
[root@ArkItServ yum.repos.d]# systemctl start multipathd – if
[root@ArkItServ yum.repos.d]# systemctl enable multipathd
[root@ArkItServ yum.repos.d]# systemctl status multipathd.service
● multipathd.service - Device-Mapper Multipath Device Controller
Loaded: loaded (/usr/lib/systemd/system/multipathd.service; enabled;
vendor preset: enabled)
Active: active (running) since Thu 2018-06-22 16:12:08 IST; 7s ago
Process: 4664 ExecStart=/sbin/multipathd (code=exited, status=0/SUCCESS)
Process: 4661 ExecStartPre=/sbin/multipath -A (code=exited,
status=0/SUCCESS)

2|Page
5. Check Multipathd service has already loaded the module to kernel
[root@ArkItServ ~]# modprobe dm_multipath
[root@ArkItServ ~]# lsmod |grep dm_multipath
dm_multipath 23065 0
dm_mod 114430 23
dm_multipath,dm_log,dm_persistent_data,dm_mirror,dm_bufio,dm_thin_pool

Procedure To Configure Linux LVM


Multipath
1. Map the LUN from SAN Storage to Linux Server using FCP protocol
2. Scan for new devices in linux server
1. echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan

note: host0–host1 = total hba host has detected in linux server

3.Verify multipath disks automatically get already enabled in multipath


configuration

multipath -ll command to list all multipath devices

3|Page
4. Use multipath alias section to specify alternative name to override friendly
name. Below is the actual /etc/multipath.conf file configuration for failover
device path
### Default Multipath configuration RHEL 7 ###
defaults {
udev_dir /dev
polling_interval 10
selector "round-robin 0"
path_grouping_policy failover
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
# prio_callout "/sbin/mpath_prio_ontap /dev/%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
}

## Device Blacklist Rule ## --> to block device path list by specifying


block list to will not show in multipath
command list, note:: if there is not request
to specific block device list then leave it
blank/don’t edit.
blacklist {
devnode "sd[a]$"
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^hd[a-z]"
devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"

## Multipath Aliases ###

multipaths {

multipath {
wwid 4500a098038303635685d472f492d6b5q --> UUID device block mpath1
alias DATA-DISK --> name alias for device block mpath1
path_grouping_policy failover --> Define rule active-passive

# ONTAP Path: ark-netapp-03:/vol/prod_ora_disk1/prod_disk1


# LUN: 1
# LUN Size: 500g
# Host Device: mpath1(4500a098038303635685d472f492d6b5q)
# 5:0:0:5 sdp
# 6:0:0:5 sdq
# 6:0:1:5 sds
# 5:0:1:5 sdr
}
}

4|Page
3. Check new changes

4. Add partition mappings


# kpartx -a /dev/mapper/DATA-DISK

5. Verify the device mapper


# ls -al /dev/mapper/

6. Create Linux LVM partition using fdisk utility


# fdisk /dev/mapper/DATA-DISK

:n –> new partition


:p -> create partition
Enter -> set partition
Enter -> set partition
t -> type partition
8e -> Set type partition to LVM
:wq -> save

Output device path name after create partition: /dev/mapper/DATA-DISKp1

Kpartx –a /dev/mapper/DATA-DISK

5|Page
Start To Create Linux LVM using
multipath disk
1. Define path /dev/mapper/DATA-DISKp1 to physical volume
# pvcreate /dev/mapper/DATA-DISKp1
Writing physical volume data to disk "/dev/mapper/DATA-DISKp1"
Physical volume "/dev/mapper/DATA-DISKp1" successfully created

Physical volume is created successfully, using multipath Linux


LVM

2. Create new volume group name for path /dev/mapper/DATA-DISKp1


# vgcreate DATAVG /dev/mapper/DATA-DISKp1
Volume group "DATAVG" successfully created

Volume Group "DATAVG" has created using Multipath PV

3. Create new logical volume name


# lvcreate -n LV03 -l 100%FREE DATAVG
Logical volume "LV03" created

Logical Volume LV03 with 100% free space now in place

4. Format Newly created Logical Volume


# mkfs -t ext4 /dev/DATAVG/LV03

You have successfully configure Linux LVM Multipath

5. Mount formatted partition and use it


# mount /dev/DATAVG/LV03 /mountpoint

6. Set Permanent mount by add entry below line in to /etc/fstab configuration file
/dev/DATAVG/LV03 /mountpoint ext4 defaults 1 2

That’s all is redundant disk path in case of one path failure.

6|Page

You might also like