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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. chkconfig Command Examples in Linux
  2. lsattr: command not found
  3. Active FTP vs. Passive FTP
  4. nslookup Command Examples in Linux
  5. latte-dock: command not found
  6. How to Map Static IP to your Domain (with GoDaddy example)
  7. httpd Command Examples in Linux
  8. How to Configure Remote Rsyslog To Accept TLS and Non-TLS in CentOS/RHEL
  9. How to Change or Rename a Mount Point in Linux
  10. sar Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • ncat Command Examples in Linux
  • ncat: command not found
  • nautilus Command Examples in Linux
  • namei: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright