Use this when tracing LVM, LUKS, multipath or thin devices through device-mapper.
device-mapper
Device-mapper is the Linux kernel framework that creates virtual block devices from other devices. LVM, dm-crypt (LUKS), dm-multipath and thin provisioning are all built on it; inspect with dmsetup.
1. device-mapper underlies LVM, LUKS, multipath, thin, cache.
2. dm-N devices map to targets.
3. dmsetup inspects/repairs carefully.
4. Stuck devices: check holders before removal.
5. Prefer higher-level tools.
dm target → mapping → underlying devices
Context & applicabilityCommon mistakes · platform/version boundaries
device or resource busywhen removing a disk — something still maps it (dmsetup ls --tree,lsblk).- Stale device-mapper entries after LUN removal —
dmsetup remove, then remove the SCSI device. - Wrong order when removing stacked devices (unmount → LVM → LUKS → multipath → disk).
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- dm devices appear as /dev/dm-N and /dev/mapper/name.
- dmsetup shows tables and dependencies.
- Stacking order matters for removal.
dmsetup ls --tree— dm stackdmsetup table— mappingsdmsetup status— target status
ReferenceHow it works1 section · depth on demand
Device-mapper users
| Target | Used by |
|---|---|
| linear / striped | LVM |
| thin / thin-pool | LVM thin |
| snapshot | LVM snapshots |
| multipath | dm-multipath |
| crypt | LUKS/dm-crypt |
| raid | LVM RAID |
| cache / writecache | lvmcache, dm-writecache |
dmsetup ls --tree
dmsetup table
dmsetup info -c
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
device-mapper is the kernel framework that builds virtual block devices from tables of targets: linear, striped, mirror/raid, thin, crypt (LUKS), multipath, snapshot, cache, vdo. LVM, cryptsetup, multipath and Docker's devicemapper driver all use it.
dmsetup ls --tree
dmsetup table vg_data-lv_app # e.g. 0 419430400 linear 8:16 2048
dmsetup status
dmsetup info -c
A table line reads: start sector, length in sectors, target type, target arguments. dmsetup remove of a busy device fails; find the holder in /sys/block/dm-N/holders or with lsof.
ReferenceConfiguration & state1 section · depth on demand
Commands
dmsetup ls --tree
dmsetup table
dmsetup info -c
dmsetup status
ls --tree shows how LVM, LUKS and multipath devices stack on top of physical disks — useful when a device cannot be removed because something still holds it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Linux Storage → device-mapper. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/block/index.html · confidence 94%