1LSBLK(8) System Administration LSBLK(8)
2
3
4
6 lsblk - list block devices
7
9 lsblk [options] [device...]
10
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 com‐
15 piled without udev support than 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
35 -a, --all
36 Also list empty devices and RAM disk devices.
37
38 -b, --bytes
39 Print the SIZE column in bytes rather than in a human-readable
40 format.
41
42 -D, --discard
43 Print information about the discarding capabilities (TRIM,
44 UNMAP) for each device.
45
46 -d, --nodeps
47 Do not print holder devices or slaves. For example, lsblk
48 --nodeps /dev/sda prints information about the sda device only.
49
50 -E, --dedup column
51 Use column as a de-duplication key to de-duplicate output tree.
52 If the key is not available for the device, or the device is a
53 partition and parental whole-disk device provides the same key
54 than the device is always printed.
55
56 The usual use case is to de-duplicate output on system multi-
57 path devices, for example by -E WWN.
58
59 -e, --exclude list
60 Exclude the devices specified by the comma-separated list of
61 major device numbers. Note that RAM disks (major=1) are
62 excluded by default if --all is not specified. The filter is
63 applied to the top-level devices only. This may be confusing for
64 --list output format where hierarchy of the devices is not obvi‐
65 ous.
66
67 -f, --fs
68 Output info about filesystems. This option is equivalent to
69 -o NAME,FSTYPE,LABEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINT. The
70 authoritative information about filesystems and raids is pro‐
71 vided by the blkid(8) command.
72
73 -h, --help
74 Display help text and exit.
75
76 -I, --include list
77 Include devices specified by the comma-separated list of major
78 device numbers. The filter is applied to the top-level devices
79 only. This may be confusing for --list output format where hier‐
80 archy of the devices is not obvious.
81
82 -i, --ascii
83 Use ASCII characters for tree formatting.
84
85 -J, --json
86 Use JSON output format. It's strongly recommended to use --out‐
87 put and also --tree if necessary.
88
89 -l, --list
90 Produce output in the form of a list. The output does not pro‐
91 vide information about relationships between devices and since
92 version 2.34 every device is printed only once if --pairs or
93 --raw not specified (the parsable outputs are maintained in
94 backwardly compatible way).
95
96 -M, --merge
97 Group parents of sub-trees to provide more readable output for
98 RAIDs and Multi-path devices. The tree-like output is required.
99
100 -m, --perms
101 Output info about device owner, group and mode. This option is
102 equivalent to -o NAME,SIZE,OWNER,GROUP,MODE.
103
104 -n, --noheadings
105 Do not print a header line.
106
107 -o, --output list
108 Specify which output columns to print. Use --help to get a list
109 of all supported columns. The columns may affect tree-like out‐
110 put. The default is to use tree for the column 'NAME' (see also
111 --tree).
112
113 The default list of columns may be extended if list is specified
114 in the format +list (e.g., lsblk -o +UUID).
115
116 -O, --output-all
117 Output all available columns.
118
119 -P, --pairs
120 Produce output in the form of key="value" pairs. The output
121 lines are still ordered by dependencies. All potentially unsafe
122 characters are hex-escaped (\x<code>).
123
124 -p, --paths
125 Print full device paths.
126
127 -r, --raw
128 Produce output in raw format. The output lines are still
129 ordered by dependencies. All potentially unsafe characters are
130 hex-escaped (\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and
131 MOUNTPOINT columns.
132
133 -S, --scsi
134 Output info about SCSI devices only. All partitions, slaves and
135 holder devices are ignored.
136
137 -s, --inverse
138 Print dependencies in inverse order. If the --list output is
139 requested then the lines are still ordered by dependencies.
140
141 -T, --tree[=column]
142 Force tree-like output format. If column is specified, then a
143 tree is printed in the column. The default is NAME column.
144
145 -t, --topology
146 Output info about block-device topology. This option is equiva‐
147 lent to -o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-
148 SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME.
149
150 -V, --version
151 Display version information and exit.
152
153 -x, --sort column
154 Sort output lines by column. This option enables --list output
155 format by default. It is possible to use the option --tree to
156 force tree-like output and than the tree branches are sorted by
157 the column.
158
159 -z, --zoned
160 Print the zone model for each device.
161
162 --sysroot directory
163 Gather data for a Linux instance other than the instance from
164 which the lsblk command is issued. The specified directory is
165 the system root of the Linux instance to be inspected. The real
166 device nodes in the target directory can be replaced by text
167 files with udev attributes.
168
169
171 0 success
172
173 1 failure
174
175 32 none of specified devices found
176
177 64 some specified devices found, some not found
178
179
181 LSBLK_DEBUG=all
182 enables lsblk debug output.
183
184 LIBBLKID_DEBUG=all
185 enables libblkid debug output.
186
187 LIBMOUNT_DEBUG=all
188 enables libmount debug output.
189
190 LIBSMARTCOLS_DEBUG=all
191 enables libsmartcols debug output.
192
193 LIBSMARTCOLS_DEBUG_PADDING=on
194 use visible padding characters. Requires enabled LIBSMART‐
195 COLS_DEBUG.
196
198 For partitions, some information (e.g., queue attributes) is inherited
199 from the parent device.
200
201 The lsblk command needs to be able to look up each block device by
202 major:minor numbers, which is done by using /sys/dev/block. This sysfs
203 block directory appeared in kernel 2.6.27 (October 2008). In case of
204 problems with a new enough kernel, check that CONFIG_SYSFS was enabled
205 at the time of the kernel build.
206
207
209 Milan Broz <mbroz@redhat.com>
210 Karel Zak <kzak@redhat.com>
211
213 ls(1), blkid(8), findmnt(8)
214
216 The lsblk command is part of the util-linux package and is available
217 from https://www.kernel.org/pub/linux/utils/util-linux/.
218
219
220
221util-linux February 2013 LSBLK(8)