kpartx(8)

kpartx8

Create device maps from partition tables.

Usage

kpartx [{-a | -d | -u | -l}] [-r] [-p] [-f] [-g] [{-s | -n}] [-v] wholedisk

Overview

This tool, derived from util-linux' partx, 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.

Options

-a

Add partition mappings.

-d

Delete partition mappings.

-u

Update partition mappings.

-l

List partition mappings that would be added -a.

-r

Read-only partition mappings.

-p

Set device name-partition number delimiter.

-f

Force creation of mappings; overrides 'no_partitions' feature.

-g

Force GUID partition table (GPT).

-s

Sync mode (Default). Don't return until the partitions are created.

-n

Nosync mode. Return before the partitions are created.

-v

Operate verbosely.

Examples

To mount all the partitions in a raw disk image:

kpartx -av disk.img

This will output lines such as:

add map loop1p1 (254:4): 0 409597 linear 7:1 3

The loop1p1 is the name of a device file under /dev/mapper which you can use to access the partition, for example to fsck it:

fsck /dev/mapper/loop1p1

When you're done, you need to remove the devices:

kpartx -d disk.img

Releases

12 releases since Debian 3.1 (Sarge); the text changed 9 times.

  1. 3.1
  2. 4.0
  3. 5.0–6.0
  4. 7
  5. 8
  6. 9–10
  7. 11
  8. 12
  9. 13
  10. Arch

-f since Debian 7 (Wheezy); -g since Debian 5.0 (Lenny); -n since Debian 11 (Bullseye); -r since Debian 7 (Wheezy); -s since Debian 7 (Wheezy); -u since Debian 7 (Wheezy).

Authors

This man page was assembled By Patrick Caulfield for the Debian project.

multipath-tools was developed by Christophe Varoqui <[email protected]> and others.

From multipath-tools 0.15.1-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.