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,MOUNTPOINT. The authoritative infor‐
70 mation about filesystems and raids is provided by the blkid(8)
71 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.
93
94 -M, --merge
95 Group parents of sub-trees to provide more readable output for
96 RAIDs and Multi-path devices. The tree-like output is required.
97
98 -m, --perms
99 Output info about device owner, group and mode. This option is
100 equivalent to -o NAME,SIZE,OWNER,GROUP,MODE.
101
102 -n, --noheadings
103 Do not print a header line.
104
105 -o, --output list
106 Specify which output columns to print. Use --help to get a list
107 of all supported columns. The columns may affect tree-like out‐
108 put. The default is to use tree for the column 'NAME' (see also
109 --tree).
110
111 The default list of columns may be extended if list is specified
112 in the format +list (e.g. lsblk -o +UUID).
113
114 -O, --output-all
115 Output all available columns.
116
117 -P, --pairs
118 Produce output in the form of key="value" pairs. All poten‐
119 tially unsafe characters are hex-escaped (\x<code>).
120
121 -p, --paths
122 Print full device paths.
123
124 -r, --raw
125 Produce output in raw format. All potentially unsafe characters
126 are hex-escaped (\x<code>) in the NAME, KNAME, LABEL, PARTLABEL
127 and MOUNTPOINT columns.
128
129 -S, --scsi
130 Output info about SCSI devices only. All partitions, slaves and
131 holder devices are ignored.
132
133 -s, --inverse
134 Print dependencies in inverse order. If the --list output is
135 requested then the lines are still ordered by dependencies.
136
137 -T, --tree[=column]
138 Force tree-like output format. If column is specified, then a
139 tree is printed in the column. The default is NAME column.
140
141 -t, --topology
142 Output info about block-device topology. This option is equiva‐
143 lent to -o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-
144 SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME.
145
146 -V, --version
147 Display version information and exit.
148
149 -x, --sort column
150 Sort output lines by column. This option enables --list output
151 format by default. It is possible to use the option --tree to
152 force tree-like output and than the tree branches are sorted by
153 the column.
154
155 -z, --zoned
156 Print the zone model for each device.
157
158 --sysroot directory
159 Gather data for a Linux instance other than the instance from
160 which the lsblk command is issued. The specified directory is
161 the system root of the Linux instance to be inspected. This
162 option is designed for the testing purpose.
163
164
166 For partitions, some information (e.g. queue attributes) is inherited
167 from the parent device.
168
169 The lsblk command needs to be able to look up each block device by
170 major:minor numbers, which is done by using /sys/dev/block. This sysfs
171 block directory appeared in kernel 2.6.27 (October 2008). In case of
172 problems with a new enough kernel, check that CONFIG_SYSFS was enabled
173 at the time of the kernel build.
174
175
177 0 success
178
179 1 failure
180
181 32 none of specified devices found
182
183 64 some specified devices found, some not found
184
185
187 Milan Broz <mbroz@redhat.com>
188 Karel Zak <kzak@redhat.com>
189
191 LSBLK_DEBUG=all
192 enables lsblk debug output.
193
194 LIBBLKID_DEBUG=all
195 enables libblkid debug output.
196
197 LIBMOUNT_DEBUG=all
198 enables libmount debug output.
199
200 LIBSMARTCOLS_DEBUG=all
201 enables libsmartcols debug output.
202
203 LIBSMARTCOLS_DEBUG_PADDING=on
204 use visible padding characters. Requires enabled LIBSMART‐
205 COLS_DEBUG.
206
208 ls(1), blkid(8), findmnt(8)
209
211 The lsblk command is part of the util-linux package and is available
212 from https://www.kernel.org/pub/linux/utils/util-linux/.
213
214
215
216util-linux February 2013 LSBLK(8)