What is DM-Multipath
Device-Mapper Multipath (DM-Multipath) is a Linux native multipath tool, which allows you to configure multiple I/O paths between server nodes and storage arrays into a single device. These I/O paths are physical SAN connections that can include separate cables, switches, and controllers. Multipathing aggregates the I/O paths, creating a new device that consists of the aggregated paths.
Create partitions DM-Multipath devices
The DM-Multipath devices will be created as /dev/mapper/mpathN, where N is the multipath group number.
1. Use command fdisk to create partitions on /dev/mapper/mpathN. Use the options “n” to create a new partition and provide “p” as the partition type which statnds for primary partition.
# fdisk /dev/mapper/mpath0 Command (m for help): n Command action e extended p primary partition (1-4) p
2. Provide the partition number, first cylider (we will use the default value of 1) and last cylinder or size of the partition.
Partition number (1-4): 1 First cylinder (1-1017, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1017, default 1017): Using default value 1017
3. Use the options “w” to write the partition table from memory to disk.
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table.
4. Register multipath partitions in /dev/mapper using the “kpartx” command:
# kpartx -a /dev/mapper/mpath0
5. List all partitions on this device:
# kpartx -l /dev/mapper/mpath0 mpath0p1 : 0 2295308 /dev/mapper/mpath0 61
Creating filesystem on DM-Multipath device partition
1. Finally, we can now create a filesystem on the newly created partition on the DM-multipath device.
# mkfs.ext4 /dev/mapper/mpath0p1 mke2fs 1.42.9 (28-Dec-2013) Filesystem too small for a journal Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 64 inodes, 508 blocks 25 blocks (4.92%) reserved for the super user First data block=1 Maximum filesystem blocks=524288 1 block group 8192 blocks per group, 8192 fragments per group 64 inodes per group Allocating group tables: done Writing inode tables: done Writing superblocks and filesystem accounting information: done
2. Create a directory and mount the partition on the mount point:
# mkdir /data # mount /dev/mapper/mpath0p1 /data
The DM-Multipath tool uses three different sets of file names:
NEVER use /dev/dm-N devices,as they are only intended to be used by the DM-Multipath tool. NEVER use /dev/mpath/mpathN devices, because when multipath devices are mounted at boot time, the UDEV subsystem may not create the device nodes soon enough.
ALWAYS use /dev/mapper/mpathN devices, as they are persistent and they are automatically created by device-mapper early in the boot process. Therefore these are the device names that should be used to access the multipathed devices. But in a RAC (Real Application Clustrer) configuration, although /dev/mapper/mpathN names may be persistent across reboots on a single machine, there is no guarantee that other cluster nodes will use the same name for this disk. If this is desired, then use the UDEV facility to get cluster-wide persistent names.