kpartx: Linux Create Device Maps From Partition Tables ( mpath devices for partitions )

Posted on in Categories , , , , , , , last updated June 5, 2008

Q. How can I create mpath devices for partitions under CentOS Linux 5?

A. You need to use tool called kpartx. This is derived from util-linux partx package, which reads partition tables on specified device and create device maps over partitions segments detected. It is called from hotplug upon device maps creation and deletion. This is useful for setting multipath which is used to detect multiple paths to devices for fail-over or performance reasons and coalesces them.

To Setup your multipath type the following command at a shell prompt (login as the root user):
# for d in $(ls /dev/mapper/mpath*); do kpartx -a -v $d ; done

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Leave a Comment