lsblk - list block devices
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. If the udev db is not available or lsblk is compiled without udev support, then it tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions are necessary.
By default, the command prints all block devices (except RAM disks) in a tree-like format. The same device can be repeated in the tree if it relates to other devices. The --merge option is recommended for more complicated setups to gather groups of devices and describe complex N:M relationships.
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 and --list in environments where a stable output is required.
Use lsblk --help to get a list of all available columns.
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 relationship between block devices and filesystems is not always one-to-one. The filesystem may use more block devices, or the same filesystem may be accessible by more paths. This is the reason why lsblk provides MOUNTPOINT and MOUNTPOINTS (pl.) columns. The column MOUNTPOINT displays only one mount point (usually the last mounted instance of the filesystem), and the column MOUNTPOINTS displays by multi-line cell all mount points associated with the device.
By default, the unit, sizes are expressed in, is byte, and unit prefixes are in power of 2^10 (1024). Abbreviations of symbols are exhibited truncated in order to reach a better readability, by exhibiting alone the first letter of them; examples: "1 KiB" and "1 MiB" are respectively exhibited as "1 K" and "1 M", then omitting on purpose the mention "iB", which is part of these abbreviations.
-E, --dedup column
The usual use case is to de-duplicate output on system multi-path devices, for example by -E WWN.
-e, --exclude list
-I, --include list
-o, --output list
The default list of columns may be extended if list is specified in the format +list (e.g., lsblk -o +UUID).
-w, --width number
-x, --sort column
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 <firstname.lastname@example.org>, Karel Zak <email@example.com>
For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues.
The lsblk command is part of the util-linux package which can be downloaded from Linux Kernel Archive https://www.kernel.org/pub/linux/utils/util-linux/.