1LSBLK(8)                     System Administration                    LSBLK(8)
2
3
4

NAME

6       lsblk - list block devices
7

SYNOPSIS

9       lsblk [options] [device...]
10

DESCRIPTION

12       lsblk lists information about all available or the specified block
13       devices. The lsblk command reads the sysfs filesystem and udev db to
14       gather information. If the udev db is not available or lsblk is
15       compiled without udev support, then it tries to read LABELs, UUIDs and
16       filesystem types from the block device. In this case root permissions
17       are necessary.
18
19       The command prints all block devices (except RAM disks) in a tree-like
20       format by default. Use lsblk --help to get a list of all available
21       columns.
22
23       The default output, as well as the default output from options like
24       --fs and --topology, is subject to change. So whenever possible, you
25       should avoid using default outputs in your scripts. Always explicitly
26       define expected columns by using --output columns-list and --list in
27       environments where a stable output is required.
28
29       Note that lsblk might be executed in time when udev does not have all
30       information about recently added or modified devices yet. In this case
31       it is recommended to use udevadm settle before lsblk to synchronize
32       with udev.
33
34       The relationship between block devices and filesystems is not always
35       one-to-one. The filesystem may use more block devices, or the same
36       filesystem may be accessible by more paths. This is the reason why
37       lsblk provides MOUNTPOINT and MOUNTPOINTS (pl.) columns. The column
38       MOUNTPOINT displays only one mount point (usually the last mounted
39       instance of the filesystem), and the column MOUNTPOINTS displays by
40       multi-line cell all mount points associated with the device.
41

OPTIONS

43       -A, --noempty
44           Don’t print empty devices.
45
46       -a, --all
47           Disable all built-in filters and list all empty devices and RAM
48           disk devices too.
49
50       -b, --bytes
51           Print the sizes in bytes rather than in a human-readable format.
52
53           By default, the unit, sizes are expressed in, is byte, and unit
54           prefixes are in power of 2^10 (1024). Abbreviations of symbols are
55           exhibited truncated in order to reach a better readability, by
56           exhibiting alone the first letter of them; examples: "1 KiB" and "1
57           MiB" are respectively exhibited as "1 K" and "1 M", then omitting
58           on purpose the mention "iB", which is part of these abbreviations.
59
60       -D, --discard
61           Print information about the discarding capabilities (TRIM, UNMAP)
62           for each device.
63
64       -d, --nodeps
65           Do not print holder devices or slaves. For example, lsblk --nodeps
66           /dev/sda prints information about the sda device only.
67
68       -E, --dedup column
69           Use column as a de-duplication key to de-duplicate output tree. If
70           the key is not available for the device, or the device is a
71           partition and parental whole-disk device provides the same key than
72           the device is always printed.
73
74           The usual use case is to de-duplicate output on system multi-path
75           devices, for example by -E WWN.
76
77       -e, --exclude list
78           Exclude the devices specified by the comma-separated list of major
79           device numbers. Note that RAM disks (major=1) are excluded by
80           default if --all is not specified. The filter is applied to the
81           top-level devices only. This may be confusing for --list output
82           format where hierarchy of the devices is not obvious.
83
84       -f, --fs
85           Output info about filesystems. This option is equivalent to -o
86           NAME,FSTYPE,FSVER,LABEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINTS. The
87           authoritative information about filesystems and raids is provided
88           by the blkid(8) command.
89
90       -I, --include list
91           Include devices specified by the comma-separated list of major
92           device numbers. The filter is applied to the top-level devices
93           only. This may be confusing for --list output format where
94           hierarchy of the devices is not obvious.
95
96       -i, --ascii
97           Use ASCII characters for tree formatting.
98
99       -J, --json
100           Use JSON output format. It’s strongly recommended to use --output
101           and also --tree if necessary.
102
103       -l, --list
104           Produce output in the form of a list. The output does not provide
105           information about relationships between devices and since version
106           2.34 every device is printed only once if --pairs or --raw not
107           specified (the parsable outputs are maintained in backwardly
108           compatible way).
109
110       -M, --merge
111           Group parents of sub-trees to provide more readable output for
112           RAIDs and Multi-path devices. The tree-like output is required.
113
114       -m, --perms
115           Output info about device owner, group and mode. This option is
116           equivalent to -o NAME,SIZE,OWNER,GROUP,MODE.
117
118       -n, --noheadings
119           Do not print a header line.
120
121       -o, --output list
122           Specify which output columns to print. Use --help to get a list of
123           all supported columns. The columns may affect tree-like output. The
124           default is to use tree for the column 'NAME' (see also --tree).
125
126           The default list of columns may be extended if list is specified in
127           the format +list (e.g., lsblk -o +UUID).
128
129       -O, --output-all
130           Output all available columns.
131
132       -P, --pairs
133           Produce output in the form of key="value" pairs. The output lines
134           are still ordered by dependencies. All potentially unsafe value
135           characters are hex-escaped (\x<code>). See also option --shell.
136
137       -p, --paths
138           Print full device paths.
139
140       -r, --raw
141           Produce output in raw format. The output lines are still ordered by
142           dependencies. All potentially unsafe characters are hex-escaped
143           (\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT
144           columns.
145
146       -S, --scsi
147           Output info about SCSI devices only. All partitions, slaves and
148           holder devices are ignored.
149
150       -s, --inverse
151           Print dependencies in inverse order. If the --list output is
152           requested then the lines are still ordered by dependencies.
153
154       -T, --tree[=column]
155           Force tree-like output format. If column is specified, then a tree
156           is printed in the column. The default is NAME column.
157
158       -t, --topology
159           Output info about block-device topology. This option is equivalent
160           to
161
162           -o
163           NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME.
164
165       -h, --help
166           Display help text and exit.
167
168       -V, --version
169           Print version and exit.
170
171       -w, --width number
172           Specifies output width as a number of characters. The default is
173           the number of the terminal columns, and if not executed on a
174           terminal, then output width is not restricted at all by default.
175           This option also forces lsblk to assume that terminal control
176           characters and unsafe characters are not allowed. The expected
177           use-case is for example when lsblk is used by the watch(1) command.
178
179       -x, --sort column
180           Sort output lines by column. This option enables --list output
181           format by default. It is possible to use the option --tree to force
182           tree-like output and than the tree branches are sorted by the
183           column.
184
185       -y, --shell
186           The column name will be modified to contain only characters allowed
187           for shell variable identifiers, for example, MIN_IO and FSUSE_PCT
188           instead of MIN-IO and FSUSE%. This is usable, for example, with
189           --pairs. Note that this feature has been automatically enabled for
190           --pairs in version 2.37, but due to compatibility issues, now it’s
191           necessary to request this behavior by --shell.
192
193       -z, --zoned
194           Print the zone related information for each device.
195
196       --sysroot directory
197           Gather data for a Linux instance other than the instance from which
198           the lsblk command is issued. The specified directory is the system
199           root of the Linux instance to be inspected. The real device nodes
200           in the target directory can be replaced by text files with udev
201           attributes.
202

EXIT STATUS

204       0
205           success
206
207       1
208           failure
209
210       32
211           none of specified devices found
212
213       64
214           some specified devices found, some not found
215

ENVIRONMENT

217       LSBLK_DEBUG=all
218           enables lsblk debug output.
219
220       LIBBLKID_DEBUG=all
221           enables libblkid debug output.
222
223       LIBMOUNT_DEBUG=all
224           enables libmount debug output.
225
226       LIBSMARTCOLS_DEBUG=all
227           enables libsmartcols debug output.
228
229       LIBSMARTCOLS_DEBUG_PADDING=on
230           use visible padding characters.
231

NOTES

233       For partitions, some information (e.g., queue attributes) is inherited
234       from the parent device.
235
236       The lsblk command needs to be able to look up each block device by
237       major:minor numbers, which is done by using /sys/dev/block. This sysfs
238       block directory appeared in kernel 2.6.27 (October 2008). In case of
239       problems with a new enough kernel, check that CONFIG_SYSFS was enabled
240       at the time of the kernel build.
241

AUTHORS

243       Milan Broz <mbroz@redhat.com>, Karel Zak <kzak@redhat.com>
244

SEE ALSO

246       ls(1), blkid(8), findmnt(8)
247

REPORTING BUGS

249       For bug reports, use the issue tracker at
250       https://github.com/util-linux/util-linux/issues.
251

AVAILABILITY

253       The lsblk command is part of the util-linux package which can be
254       downloaded from Linux Kernel Archive
255       <https://www.kernel.org/pub/linux/utils/util-linux/>.
256
257
258
259util-linux 2.38.1                 2022-08-04                          LSBLK(8)
Impressum