- List all storage devices in a tree-like format:lsblk- Also list empty devices:lsblk -a- Print the SIZE column in bytes rather than in a human-readable format:lsblk -b- Output info about filesystems:lsblk -f- Use ASCII characters for tree formatting:lsblk -i- Output info about block-device topology:lsblk -t
lsblk [options] [device...]
lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information.
The command prints all block devices (except RAM disks) in a tree-like format by default. Use lsblk --help to get a list of all available columns.
The default output, as well as the default output from options like --fs and --topology, is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected columns by using --output columns-list in environments where a stable output is required.
Note that lsblk might be executed in time when udev does not have all information about recently added or modified devices yet. In this case it is recommended to use udevadm settle before lsblk to synchronize with udev.
The default list of columns may be extended if list is specified in the format +list (e.g. lsblk -o +UUID).
For partitions, some information (e.g. queue attributes) is inherited from the parent device.
The lsblk command needs to be able to look up each block device by major:minor numbers, which is done by using /sys/dev/block. This sysfs block directory appeared in kernel 2.6.27 (October 2008). In case of problems with a new enough kernel, check that CONFIG_SYSFS was enabled at the time of the kernel build.
Milan Broz <email@example.com> Karel Zak <firstname.lastname@example.org>
findmnt(8), blkid(8), ls(1)
The lsblk command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.