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

EXIT STATUS

189       0
190           success
191
192       1
193           failure
194
195       32
196           none of specified devices found
197
198       64
199           some specified devices found, some not found
200

ENVIRONMENT

202       LSBLK_DEBUG=all
203           enables lsblk debug output.
204
205       LIBBLKID_DEBUG=all
206           enables libblkid debug output.
207
208       LIBMOUNT_DEBUG=all
209           enables libmount debug output.
210
211       LIBSMARTCOLS_DEBUG=all
212           enables libsmartcols debug output.
213
214       LIBSMARTCOLS_DEBUG_PADDING=on
215           use visible padding characters.
216

NOTES

218       For partitions, some information (e.g., queue attributes) is inherited
219       from the parent device.
220
221       The lsblk command needs to be able to look up each block device by
222       major:minor numbers, which is done by using /sys/dev/block. This sysfs
223       block directory appeared in kernel 2.6.27 (October 2008). In case of
224       problems with a new enough kernel, check that CONFIG_SYSFS was enabled
225       at the time of the kernel build.
226

AUTHORS

228       Milan Broz <mbroz@redhat.com>, Karel Zak <kzak@redhat.com>
229

SEE ALSO

231       ls(1), blkid(8), findmnt(8)
232

REPORTING BUGS

234       For bug reports, use the issue tracker at
235       https://github.com/karelzak/util-linux/issues.
236

AVAILABILITY

238       The lsblk command is part of the util-linux package which can be
239       downloaded from Linux Kernel Archive
240       <https://www.kernel.org/pub/linux/utils/util-linux/>.
241
242
243
244util-linux 2.37.2                 2021-08-16                          LSBLK(8)
Impressum