1 .TH LSBLK 8 "February 2013" "util-linux" "System Administration"
3 lsblk \- list block devices
10 lists information about all available or the specified block devices. The
16 to gather information. If the udev db is not available or lsblk is compiled without udev support than it
17 tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions
20 The command prints all block devices (except RAM disks) in a tree-like format
23 to get a list of all available columns.
25 The default output, as well as the default output from options like
29 is subject to change. So whenever possible, you should avoid using default
30 outputs in your scripts. Always explicitly define expected columns by using
35 in environments where a stable output is required.
39 might be executed in time when
41 does not have all information about recently added or modified devices yet. In this
42 case it is recommended to use
44 before lsblk to synchronize with udev.
48 Also list empty devices and RAM disk devices.
50 .BR \-b , " \-\-bytes"
51 Print the SIZE column in bytes rather than in a human-readable format.
53 .BR \-D , " \-\-discard"
54 Print information about the discarding capabilities (TRIM, UNMAP) for each device.
56 .BR \-d , " \-\-nodeps"
57 Do not print holder devices or slaves. For example, \fBlsblk \-\-nodeps /dev/sda\fR prints
58 information about the sda device only.
60 .BR \-E , " \-\-dedup " \fIcolumn\fP
61 Use \fIcolumn\fP as a de-duplication key to de-duplicate output tree. If the
62 key is not available for the device, or the device is a partition and parental
63 whole-disk device provides the same key than the device is always printed.
65 The usual use case is to de-duplicate output on system multi-path devices, for
66 example by \fB\-E WWN\fR.
68 .BR \-e , " \-\-exclude " \fIlist\fP
69 Exclude the devices specified by the comma-separated \fIlist\fR of major device numbers.
70 Note that RAM disks (major=1) are excluded by default if \fB\-\-all\fR is not specified.
71 The filter is applied to the top-level devices only. This may be confusing for
72 \fB\-\-list\fR output format where hierarchy of the devices is not obvious.
75 Output info about filesystems. This option is equivalent to
76 .BR \-o\ NAME,FSTYPE,LABEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINT .
77 The authoritative information about filesystems and raids is provided by the
82 Display help text and exit.
84 .BR \-I , " \-\-include " \fIlist\fP
85 Include devices specified by the comma-separated \fIlist\fR of major device numbers.
86 The filter is applied to the top-level devices only. This may be confusing for
87 \fB\-\-list\fR output format where hierarchy of the devices is not obvious.
89 .BR \-i , " \-\-ascii"
90 Use ASCII characters for tree formatting.
93 Use JSON output format. It's strongly recommended to use \fB\-\-output\fR and
94 also \fB\-\-tree\fR if necessary.
97 Produce output in the form of a list. The output does not provide information
98 about relationships between devices and since version 2.34 every device is
99 printed only once if \fB\-\-pairs\fR or \fB\-\-raw\fR not specified (the
100 parsable outputs are maintained in backwardly compatible way).
102 .BR \-M , " \-\-merge"
103 Group parents of sub-trees to provide more readable output for RAIDs and
104 Multi-path devices. The tree-like output is required.
106 .BR \-m , " \-\-perms"
107 Output info about device owner, group and mode. This option is equivalent to
108 .BR \-o\ NAME,SIZE,OWNER,GROUP,MODE .
110 .BR \-n , " \-\-noheadings"
111 Do not print a header line.
113 .BR \-o , " \-\-output " \fIlist\fP
114 Specify which output columns to print. Use
116 to get a list of all supported columns. The columns may affect tree-like output.
117 The default is to use tree for the column 'NAME' (see also \fB\-\-tree\fR).
119 The default list of columns may be extended if \fIlist\fP is
120 specified in the format \fI+list\fP (e.g., \fBlsblk \-o +UUID\fP).
122 .BR \-O , " \-\-output\-all"
123 Output all available columns.
125 .BR \-P , " \-\-pairs"
126 Produce output in the form of key="value" pairs. The output lines are still ordered by
127 dependencies. All potentially unsafe characters are hex-escaped (\\x<code>).
129 .BR \-p , " \-\-paths"
130 Print full device paths.
133 Produce output in raw format. The output lines are still ordered by
134 dependencies. All potentially unsafe characters are hex-escaped
135 (\\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT columns.
137 .BR \-S , " \-\-scsi"
138 Output info about SCSI devices only. All partitions, slaves and holder devices are ignored.
140 .BR \-s , " \-\-inverse"
141 Print dependencies in inverse order. If the \fB\-\-list\fR output is requested then
142 the lines are still ordered by dependencies.
144 .BR \-T , " \-\-tree" [ =\fIcolumn ]
145 Force tree-like output format. If \fIcolumn\fP is specified, then a tree is printed in the column.
146 The default is NAME column.
148 .BR \-t , " \-\-topology"
149 Output info about block-device topology.
150 This option is equivalent to
151 .BR \-o\ NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME .
153 .BR \-V , " \-\-version"
154 Display version information and exit.
156 .BR \-x , " \-\-sort " \fIcolumn\fP
157 Sort output lines by \fIcolumn\fP. This option enables \fB\-\-list\fR output format by default.
158 It is possible to use the option \fI\-\-tree\fP to force tree-like output and
159 than the tree branches are sorted by the \fIcolumn\fP.
161 .BR \-z , " \-\-zoned"
162 Print the zone model for each device.
164 .BR " \-\-sysroot " \fIdirectory\fP
165 Gather data for a Linux instance other than the instance from which the lsblk
166 command is issued. The specified directory is the system root of the Linux
167 instance to be inspected. The real device nodes in the target directory can
168 be replaced by text files with udev attributes.
171 For partitions, some information (e.g., queue attributes) is inherited from the
176 command needs to be able to look up each block device by major:minor numbers,
177 which is done by using
179 This sysfs block directory appeared in kernel 2.6.27 (October 2008).
180 In case of problems with a new enough kernel, check that CONFIG_SYSFS
181 was enabled at the time of the kernel build.
189 none of specified devices found
191 some specified devices found, some not found
195 Milan Broz <mbroz@redhat.com>
196 Karel Zak <kzak@redhat.com>
200 enables lsblk debug output.
201 .IP LIBBLKID_DEBUG=all
202 enables libblkid debug output.
203 .IP LIBMOUNT_DEBUG=all
204 enables libmount debug output.
205 .IP LIBSMARTCOLS_DEBUG=all
206 enables libsmartcols debug output.
207 .IP LIBSMARTCOLS_DEBUG_PADDING=on
208 use visible padding characters. Requires enabled LIBSMARTCOLS_DEBUG.
214 The lsblk command is part of the util-linux package and is available from
215 https://www.kernel.org/pub/linux/utils/util-linux/.