DRIVEMAP(1)
π drivemap β the drivemap(1) page, bestie edition π
okay so. you know how block devices are likeβ¦ a whole situationship of dependencies? yeah. drivemap is the manual page for the drivemap command, and it lives in the User commands section of the manual, and it's about to be your new favorite thing, no cap. π¦
β¨ NAME β¨
drivemap β show block devices in a tree of dependencies π³
π SYNOPSIS π
drivemap [-i|--info [-w|--width N]] [-d|--drive] [FILE]
drivemap [-i|--info [-w|--width N]] [-p|--mountpoint]
[-f|--backing-file] [-n|--dm-name] [-m|--mark] [FILE]
drivemap -h|--help
drivemap [--debug] [-x|--set-x] [OPTIONS] [FILE]
like. look at those four whole moods. pick your vibe. π
πΈ DESCRIPTION πΈ
drivemap is a shell script that uses the proc, sysfs and udev databases to show block devices in a tree of dependencies. it's based on bilibop-common shell functions, and it supports device-mapper (yes, including dm-crypt and LVM π) and loop devices β with some limitations, bestie, we'll get there.
RAID devices and mhddfs filesystems are NOT supported. periodt. see the ENHANCEMENTS AND LIMITATIONS section down below for the whole tea.
π OPTIONS π
When no FILE argument is invoked, the command is applied to all drives. If a FILE is given as argument and exists, then the command applies to the drive hosting it. FILE can be a regular file, a directory or a block device. (yes, all three, she's versatile β¨)
--debugβ Display debug information onstderr. When this option is invoked, each called function prints its name. See also'--set-x'. π-d,--driveβ Only show the drive node instead of its tree. like, just the main character, no entourage. π-f,--backing-fileβ Try to replace each loop device in the tree by its backing file. This can fail in some cases: for example on DebianLive systems, a loop device is associated tofilesystem.squashfsfrom into the initramfs environment; the path of the backing file in/sysis not updated when the squashfs itself becomes the new root filesystem. And so the filename stored inbacking_fileis obsolete, and will not be displayed here. π (not her fault fr fr)-h,--helpβ Print a summary of options onstdoutand exit. the polite escape hatch π«Ά-i,--infoβ Display additional information about block devices. For drives, this includes the ID (as found in/dev/disk/by-id), and the size (human readable). For other devices (partitions and virtual block devices), this includes the filesystem type ant its size. β¨-m,--markβ If aFILEis given as argument, append a mark (a star between parenthesis:(*)) to the name of the device hosting thisFILE. Otherwise, append a mark to the name of the device hosting the current working directory. β-n,--dm-nameβ Replace device-mapper nodes (/dev/dm-*) by device-mapper names (/dev/mapper/*), which are statically attributed and generally easier to understand. lowkey a glow-up π-p,--mountpointβ Show the mountpoints of mounted devices, and show swap devices in use. π-w N,--width=Nβ Format the output onNcolumns. Can be used with'--info'and/or'--mountpoint'. IfNis not an integer or is greater than the number of columns of the screen, then the output will use the full width of the screen. If this option is not used, then the default is to display the result on 70 columns.-x,--set-xβ Display debug information onstderr. When this option is invoked, the shell script is set as-x, for more debug details. See also'--debug'. π
π ENHANCEMENTS AND LIMITATIONS π
drivemap is a part of the bilibop(7) project. It has initially been written to be applied to the external drive hosting the running system.
By design, it don't support RAID devices, and will never support them. periodt. π«
Another design issue is that lvm(8) Volume Groups should contain only one Physical Volume. We assume that there is no sense to use several Physical Volumes on the same drive for the same Volume Group. Adopting a parent/child mindview, we say that each device can have at most one parent but zero to several children. Since the script has been extended to be applied to all drives connected to the computer, this sounds like a bug. π (she said it, not me)
Unlike the lsblk(1) command, drivemap integrates loopback devices in the tree of dependencies. In fact, the question that can be asked is the following:
" What will happen to the content of other physical or virtual block devices if Idd(1),shred(1)orwipe(1)this one or this one ? "
And then it appears that slaves and holders information in sysfs are not sufficient to organize block devices in a tree, or should be extended. For the same reason, logical partitions are shown as subdevices of primary extended partitions. π§
Only block devices whose contents is hosted by a physical disk are shown: this means if a loop device is associated to a file residing on a temporary filesystem (tmpfs, i.e. the RAM), this device will not be shown. This is NOT a bug: as said by its name, drivemap builts and displays a 'map of drive(s)'. π
π EXAMPLES π
List the physical drives actually known by the kernel:
drivemap -d
Find the drive hosting the running system, and display its ID and size:
drivemap -id /
Show where is my current working directory on a disk with a complex partition scheme (LVM + LUKS + LVM):
drivemap -min .
π BUGS π
See the ENHANCEMENTS AND LIMITATIONS section above. yeah. that one. go read it. π
π FILES π
/sys/class/block/*/holders/sys/class/block/*/slaves/sys/class/block/loop?*/loop/backing_file
π₯ SEE ALSO π₯
bilibop(7), lsbilibop(8), lsblk(1), lvm(8), udev(7), udevadm(8)
π AUTHOR π
This manual page has been written by Bilibop Project <quidame@poivron.org>.
and that's the whole page bestie!! π«Ά this one's from the bilibop project, dated 2012-05-22, and it's giving vintage-but-timeless. read it, run it, slay it. β¨π πΈ
π¦ where this page comes from
- debian bookworm: bilibop-common 0.6.3 Β· GPL-3.0-or-later
- debian trixie: bilibop-common 0.6.5 Β· GPL-3.0-or-later
- ubuntu jammy: bilibop-common 0.6.3 Β· GPL-3.0-or-later
- ubuntu noble: bilibop-common 0.6.3 Β· GPL-3.0-or-later
- ubuntu resolute: bilibop-common 0.6.5 Β· GPL-3.0-or-later
- ubuntu stonking: bilibop-common 0.6.5 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms