Display layering of devices in Linux
Modern Linux systems can have complex layering of devices from the physical drive to the filesystem, through partitions, iSCSI, dm-crypt, multipath, LVM, etc.
There are 2 useful commands to display the device tree:
- dmsetup (part of the debian package: dmsetup)
# dmsetup ls --tree
PC-Home (253:3)
└─sda5_crypt (253:0)
└─ (8:5)
PC-Swap (253:1)
└─sda5_crypt (253:0)
└─ (8:5)
PC-Root (253:2)
└─sda5_crypt (253:0)
└─ (8:5)
- lsblk (debian package: util-linux)
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 447,1G 0 disk
├─sda1 8:1 0 1,5G 0 part
├─sda2 8:2 0 50G 0 part
├─sda3 8:3 0 1M 0 part
├─sda4 8:4 0 10G 0 part
├─sda5 8:5 0 236,2G 0 part
│ └─sda5_crypt 253:0 0 236,2G 0 crypt
│ ├─PC-Swap 253:1 0 4,2G 0 lvm [SWAP]
│ ├─PC-Root 253:2 0 32,6G 0 lvm /
│ └─PC-Home 253:3 0 189,1G 0 lvm /home
├─sda6 8:6 0 500M 0 part /boot
├─sda7 8:7 0 78,1G 0 part
└─sda8 8:8 0 5,9G 0 part
sr0 11:0 1 1024M 0 rom