I know a tool kpartx
can be used to configure multipath on system. But what does the CONFIG_DM_MULTIPATH
kernel module do? My system does not have this module compiled, and it seems the kpartx
tools works very well. It seems they are not related, am I right?
CONFIG_DM_MULTIPATH
is not the name of a kernel module; it's the name of a kernel configuration option that enables thedm_multipath
driver, which in turn enables multipath i/o for block devices. "Multipath I/O" means that a single device (think "disk") can be accessed via multiple communication channels -- for example, a storage array connected via a pair of fibre channel links. Without the multipath driver, each link looks like a separate device, which can lead to confusion. The multipath driver can present these two links as a single device, and take care of selecting an alternative path if one path fails.This document from RedHat has a good discussion of multipath support under Linux.
You are correct that this has very little to do with
kpartx
.kpartx
is just the component to create "multipathed" device entries for the partitions on a multipathed storage unit.Imagine you insert a dual-pathed fibre channel disk with one single partition:
udev
discovers the disk, the "basic" kernel assigns two different devices to each of the disk's pathes (eg./dev/sdx
and/dev/sdy
) , and subsequently, the one partition is visible as/dev/sdx1
and/dev/sdy1
.Now, kpartx comes into play and creates a
/dev/mapper/<ID of the new disk>p1
device (sometimes also shown as-part1
).This special partition entry is what you should use for your application (instead of the dev/sd[xy]1
entries). That makes sure you access the underlying partition via the multipath module's *combined* device
/dev/mapper/and not via just one path's
/dev/sdx1` entry.The kpartx utility is so to say just a "parser" for partition tables on multipathed devices, creating multipathed device nodes just for their partitions.