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 and file system on DM-Multipath devices
1. The DM-Multipath devices will be created as /dev/mapper/mpathN, where N is the multipath group number. Use command fdisk to create partitions on /dev/mapper/mpathN:
# fdisk /dev/mapper/mpath0 Command (m for help): n Command action e extended p primary partition (1-4) p 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 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table.
2. Register multipath partitions in /dev/mapper:
# kpartx -a /dev/mapper/mpath0
3. List all partitions on this device:
# kpartx -l /dev/mapper/mpath0 mpath0p1 : 0 2295308 /dev/mapper/mpath0 61
4. Create a file system on partitions:
# mkfs -t ext3 /dev/mapper/mpath0p1 mke2fs 1.35 (28-Feb-2004) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 143712 inodes, 286913 blocks 14345 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=297795584 9 block groups 32768 blocks per group, 32768 fragments per group 15968 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376 Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
5. Mount the partition on the mount point:
# mkdir /datafile # mount /dev/mapper/mpath0p1 /datafile
The DM-Multipath tool uses three different sets of file names:
1. NEVER use /dev/dm-N devices, as they are only intended to be used by the DM-Multipath tool.
2. NEVER use /dev/mpath/mpathNdevices, because when multipath devices are mounted at boot time, the UDEV subsystem may not create the device nodes soon enough.
3. 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 Cluster) 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.