• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to create partitions and file systems on DM-Multipath devices

By admin

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.

Beginners guide to Device Mapper (DM) multipathing

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

Notes

The DM-Multipath tool uses three different sets of file names:
1. /dev/dm-N
2. /dev/mpath/mpathN
3. /dev/mapper/mpathN

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.

How to Install and Configure Device Mapper Multipath in CentOS/RHEL 6,7

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. Difference between the Java heap and native C heap
  2. How to Change Kernel Semaphore Limits in CentOS/RHEL
  3. Changing the IPset rules from IPtables to Firewalld in CentOS/RHEL 7
  4. The System Activity Reporter (sar) Command in Linux
  5. How to Recover Deleted rpm Package Files(libraries, configuration files) in CentOS/RHEL 7
  6. How to configure CentOS/RHEL 6 system to not used last 3 passwords used
  7. How to recover GRUB (Corrupted boot partition) in CentOS/RHEL 5,6
  8. How to use ‘yum’ to connect ULN on CentOS/RHEL/OEL 6
  9. How to Disable “alt+ctrl+Del” Key Combination causing reboot in CentOS/RHEL 4,5
  10. How to configure iSCSI target using targetcli in CentOS / RHEL 7

You May Also Like

Primary Sidebar

Recent Posts

  • SQL script to find tables that are fragmented
  • TRUNCATE TABLE not releasing space from tablespace
  • How to reclaim entire space of an oracle database table with “Truncate Table” statement
  • Oracle SQL Script to Report Tablespace Free and Fragmentation
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary