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 in environments
27 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 -z, --zoned
47 Print the zone model for each device.
48
49 -d, --nodeps
50 Do not print holder devices or slaves. For example, lsblk
51 --nodeps /dev/sda prints information about the sda device only.
52
53 -e, --exclude list
54 Exclude the devices specified by the comma-separated list of
55 major device numbers. Note that RAM disks (major=1) are
56 excluded by default if --all is no specified. The filter is
57 applied to the top-level devices only.
58
59 -f, --fs
60 Output info about filesystems. This option is equivalent to
61 -o NAME,FSTYPE,LABEL,UUID,MOUNTPOINT. The authoritative infor‐
62 mation about filesystems and raids is provided by the blkid(8)
63 command.
64
65 -h, --help
66 Display help text and exit.
67
68 -I, --include list
69 Include devices specified by the comma-separated list of major
70 device numbers. The filter is applied to the top-level devices
71 only.
72
73 -i, --ascii
74 Use ASCII characters for tree formatting.
75
76 -J, --json
77 Use JSON output format.
78
79 -l, --list
80 Produce output in the form of a list.
81
82 -m, --perms
83 Output info about device owner, group and mode. This option is
84 equivalent to -o NAME,SIZE,OWNER,GROUP,MODE.
85
86 -n, --noheadings
87 Do not print a header line.
88
89 -o, --output list
90 Specify which output columns to print. Use --help to get a list
91 of all supported columns.
92
93 The default list of columns may be extended if list is specified
94 in the format +list (e.g. lsblk -o +UUID).
95
96 -O, --output-all
97 Output all available columns.
98
99 -P, --pairs
100 Produce output in the form of key="value" pairs. All poten‐
101 tially unsafe characters are hex-escaped (\x<code>).
102
103 -p, --paths
104 Print full device paths.
105
106 -r, --raw
107 Produce output in raw format. All potentially unsafe characters
108 are hex-escaped (\x<code>) in the NAME, KNAME, LABEL, PARTLABEL
109 and MOUNTPOINT columns.
110
111 -S, --scsi
112 Output info about SCSI devices only. All partitions, slaves and
113 holder devices are ignored.
114
115 -s, --inverse
116 Print dependencies in inverse order. If the --list output is
117 requested then the lines are still ordered by dependencies.
118
119 -t, --topology
120 Output info about block-device topology. This option is equiva‐
121 lent to -o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-
122 SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME.
123
124 -V, --version
125 Display version information and exit.
126
127 -x, --sort column
128 Sort output lines by column. This option enables --list output
129 format by default. It is possible to use the option --tree to
130 force tree-like output and than the tree branches are sorted by
131 the column.
132
134 For partitions, some information (e.g. queue attributes) is inherited
135 from the parent device.
136
137 The lsblk command needs to be able to look up each block device by
138 major:minor numbers, which is done by using /sys/dev/block. This sysfs
139 block directory appeared in kernel 2.6.27 (October 2008). In case of
140 problems with a new enough kernel, check that CONFIG_SYSFS was enabled
141 at the time of the kernel build.
142
143
145 0 success
146
147 1 failure
148
149 32 none of specified devices found
150
151 64 some specified devices found, some not found
152
153
155 Milan Broz <mbroz@redhat.com>
156 Karel Zak <kzak@redhat.com>
157
159 LSBLK_DEBUG=all
160 enables lsblk debug output.
161
162 LIBBLKID_DEBUG=all
163 enables libblkid debug output.
164
165 LIBMOUNT_DEBUG=all
166 enables libmount debug output.
167
168 LIBSMARTCOLS_DEBUG=all
169 enables libsmartcols debug output.
170
171 LIBSMARTCOLS_DEBUG_PADDING=on
172 use visible padding characters. Requires enabled LIBSMART‐
173 COLS_DEBUG.
174
176 ls(1), blkid(8), findmnt(8)
177
179 The lsblk command is part of the util-linux package and is available
180 from https://www.kernel.org/pub/linux/utils/util-linux/.
181
182
183
184util-linux February 2013 LSBLK(8)