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       By default, the command prints all block devices (except RAM disks) in
20       a tree-like format. The same device can be repeated in the tree if it
21       relates to other devices. The --merge option is recommended for more
22       complicated setups to gather groups of devices and describe complex N:M
23       relationships.
24
25       The default output, as well as the default output from options like
26       --fs and --topology, is subject to change. So whenever possible, you
27       should avoid using default outputs in your scripts. Always explicitly
28       define expected columns by using --output columns-list and --list in
29       environments where a stable output is required.
30
31       Use lsblk --help to get a list of all available columns.
32
33       Note that lsblk might be executed in time when udev does not have all
34       information about recently added or modified devices yet. In this case
35       it is recommended to use udevadm settle before lsblk to synchronize
36       with udev.
37
38       The relationship between block devices and filesystems is not always
39       one-to-one. The filesystem may use more block devices, or the same
40       filesystem may be accessible by more paths. This is the reason why
41       lsblk provides MOUNTPOINT and MOUNTPOINTS (pl.) columns. The column
42       MOUNTPOINT displays only one mount point (usually the last mounted
43       instance of the filesystem), and the column MOUNTPOINTS displays by
44       multi-line cell all mount points associated with the device.
45

OPTIONS

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

EXIT STATUS

214       0
215           success
216
217       1
218           failure
219
220       32
221           none of specified devices found
222
223       64
224           some specified devices found, some not found
225

ENVIRONMENT

227       LSBLK_DEBUG=all
228           enables lsblk debug output.
229
230       LIBBLKID_DEBUG=all
231           enables libblkid debug output.
232
233       LIBMOUNT_DEBUG=all
234           enables libmount debug output.
235
236       LIBSMARTCOLS_DEBUG=all
237           enables libsmartcols debug output.
238
239       LIBSMARTCOLS_DEBUG_PADDING=on
240           use visible padding characters.
241

NOTES

243       For partitions, some information (e.g., queue attributes) is inherited
244       from the parent device.
245
246       The lsblk command needs to be able to look up each block device by
247       major:minor numbers, which is done by using /sys/dev/block. This sysfs
248       block directory appeared in kernel 2.6.27 (October 2008). In case of
249       problems with a new enough kernel, check that CONFIG_SYSFS was enabled
250       at the time of the kernel build.
251

AUTHORS

253       Milan Broz <gmazyland@gmail.com>, Karel Zak <kzak@redhat.com>
254

SEE ALSO

256       ls(1), blkid(8), findmnt(8)
257

REPORTING BUGS

259       For bug reports, use the issue tracker at
260       https://github.com/util-linux/util-linux/issues.
261

AVAILABILITY

263       The lsblk command is part of the util-linux package which can be
264       downloaded from Linux Kernel Archive
265       <https://www.kernel.org/pub/linux/utils/util-linux/>.
266
267
268
269util-linux 2.39.2                 2023-06-14                          LSBLK(8)
Impressum