KPARTX(8)
๐ KPARTX(8) โ the kpartx manual ๐
โจ NAME โจ
okay so kpartx is the tool that turns partitions into device maps ๐
It creates device maps from partition tables.
๐ธ SYNOPSIS ๐ธ
kpartx [-a|-d|-u|-l] [-r] [-p] [-f] [-g] [-s|-n] [-v] wholedisk
๐ DESCRIPTION ๐
bestie, this one is lowkey iconic. It's derived from util-linux' partx ๐ฆ It reads the partition tables on the device you give it and creates device maps over the partition segments it finds. Hotplug calls it when device maps get created and deleted, so you don't have to do that part yourself โจ
๐ OPTIONS ๐
-aโ add partition mappings ๐ซถ-dโ delete partition mappings ๐-uโ update partition mappings ๐ฅ-lโ list the partition mappings that would be added by-a๐-rโ make the partition mappings read-only ๐-pโ set the delimiter between the device name and the partition number ๐ง-fโ force the creation of mappings, even if it overrides theno_partitionsfeature ๐ญ-gโ force a GUID partition table (GPT) ๐-sโ sync mode, which is the default โจ it won't return until the partitions are created, so no cap, you can rely on it being done-nโ nosync mode ๐ it returns before the partitions are created-vโ operate verbosely ๐ฃ
๐ง EXAMPLE ๐ง
okay so say you want to mount all the partitions in a raw disk image ๐ฅน you'd run:
kpartx -av disk.img
and it'll print lines that look like this:
add map loop1p1 (254:4): 0 409597 linear 7:1 3
the loop1p1 bit is the name of a device file under /dev/mapper, and that's what you use to get at the partition. for example, to fsck it:
fsck /dev/mapper/loop1p1
when you're finished, you need to remove the devices too, so run:
kpartx -d disk.img
๐ฆ SEE ALSO ๐ฆ
multipath(8) multipathd(8) hotplug(8)
๐ AUTHORS ๐
this man page was assembled By Patrick Caulfield for the Debian project ๐
multipath-tools was developed by Christophe Varoqui <christophe.varoqui@opensvc.com> and others ๐ซถ
that's the whole tea, bestie ๐โจ this page is from the Linux manual, dated 2019-04-27, and it's all about KPARTX(8) ๐ love you, mwah ๐๐
๐ฆ where this page comes from
- alpine 3.22: multipath-tools-doc 0.11.1-r2 ยท LGPL-2.0-only
- alpine 3.23: multipath-tools-doc 0.13.0-r0 ยท LGPL-2.0-only
- alpine 3.24: multipath-tools-doc 0.13.0-r0 ยท LGPL-2.0-only
- centos-stream 10: kpartx 0.9.9-20.el10 ยท GPLv2
- debian trixie: kpartx 0.11.1-2
- fedora 43: kpartx 0.11.1-2.fc43 ยท GPL-2.0-only AND GPL-3.0-only
- fedora 44: kpartx 0.13.1-1.fc44 ยท GPL-2.0-only AND GPL-3.0-only
- nixos 26.05: multipath-tools 0.14.1
- nixpkgs unstable: multipath-tools 0.14.3
- opensuse-leap 16.0: kpartx 0.12.4+278+suse.9cf9c5c-160000.1.1 ยท GPL-2.0-only
- opensuse-leap 16.0: kpartx 0.12.4+278+suse.9cf9c5c-160000.1.1 ยท GPL-2.0-only
- opensuse-leap 16.0: kpartx 0.12.4+278+suse.9cf9c5c-160000.1.1 ยท GPL-2.0-only
- opensuse-leap 16.0: kpartx 0.12.4+278+suse.9cf9c5c-160000.1.1 ยท GPL-2.0-only
- ubuntu questing: kpartx 0.11.1-3ubuntu2
- ubuntu resolute: kpartx 0.14.3-2ubuntu1
- ubuntu stonking: kpartx 0.14.3-3ubuntu2
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms