Create, inspect and control kernel device-mapper mappings for flexible block-device setups. 07.07.2026 | reading time: 2 min Device-mapper is the kernel layer that builds virtual block devices; the `dmsetup` utility talks to that layer so a sysadmin can create, inspect and control mappings from user space; this article shows why `dmsetup` matters and how to use it in practice. Hands-On Example Create a small test image, attach it as a loop device and map it with a simple linear table to see `dmsetup` in action: ```sh $ truncate -s 10M disk.img $ losetup --find --show disk.img /dev/loop0 $ echo "0 20480 linear /dev/loop0 0" | dmsetup create mydev $ dmsetup ls mydev (253:0) $ dmsetup table mydev 0 20480 linear /dev/loop0 0 $ dmsetup remove mydev $ losetup -d /dev/loop0 ``` Flags and Tricks Use `dmsetup ls`, `dmsetup table`, `dmsetup info` and `dmsetup status` to inspect devices; `create` and `remove` build and tear down mappings, `reload` updates tables without removing node, and `suspend`/`resume` help handle live changes; remember that sizes in tables are in 512-byte sectors, so calculate counts accurately for a correct mapping. Nearby Tools Device-mapper is the foundation for higher-level tooling: LVM uses it to present logical volumes, `cryptsetup` uses it for dm-crypt encrypted devices, and multipath or storage stacks build on top of it; use `losetup` to prepare loop-backed devices when testing mappings. Final Thought `dmsetup` is a compact, powerful tool that exposes kernel mapping primitives for storage orchestration; experiment with safe test images, then explore how LVM and dm-crypt use the same primitives; to deepen practical Linux skills consider formal study such as CompTIA Linux+ or LPIC-1 and intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. storage utilities setup virtualization infrastructure This page was created with the help of AI.