]> git.ipfire.org Git - thirdparty/util-linux.git/blame_incremental - misc-utils/lsblk.8
Manual pages: order NOTES / HISTORY / BUGS / EXAMPLE consistently
[thirdparty/util-linux.git] / misc-utils / lsblk.8
... / ...
CommitLineData
1.TH LSBLK 8 "February 2013" "util-linux" "System Administration"
2.SH NAME
3lsblk \- list block devices
4.SH SYNOPSIS
5.B lsblk
6[options]
7.RI [ device ...]
8.SH DESCRIPTION
9.B lsblk
10lists information about all available or the specified block devices. The
11.B lsblk
12command reads the
13.B sysfs
14filesystem and
15.B udev db
16to gather information. If the udev db is not available or lsblk is compiled without udev support than it
17tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions
18are necessary.
19.PP
20The command prints all block devices (except RAM disks) in a tree-like format
21by default. Use
22.B "lsblk \-\-help"
23to get a list of all available columns.
24.PP
25The default output, as well as the default output from options like
26.B \-\-fs
27and
28.BR \-\-topology ,
29is subject to change. So whenever possible, you should avoid using default
30outputs in your scripts. Always explicitly define expected columns by using
31.B \-\-output
32.I columns-list
33and
34.B \-\-list
35in environments where a stable output is required.
36.PP
37Note that
38.B lsblk
39might be executed in time when
40.B udev
41does not have all information about recently added or modified devices yet. In this
42case it is recommended to use
43.B "udevadm settle"
44before lsblk to synchronize with udev.
45.SH OPTIONS
46.TP
47.BR \-a , " \-\-all"
48Also list empty devices and RAM disk devices.
49.TP
50.BR \-b , " \-\-bytes"
51Print the SIZE column in bytes rather than in a human-readable format.
52.TP
53.BR \-D , " \-\-discard"
54Print information about the discarding capabilities (TRIM, UNMAP) for each device.
55.TP
56.BR \-d , " \-\-nodeps"
57Do not print holder devices or slaves. For example, \fBlsblk \-\-nodeps /dev/sda\fR prints
58information about the sda device only.
59.TP
60.BR \-E , " \-\-dedup " \fIcolumn\fP
61Use \fIcolumn\fP as a de-duplication key to de-duplicate output tree. If the
62key is not available for the device, or the device is a partition and parental
63whole-disk device provides the same key than the device is always printed.
64
65The usual use case is to de-duplicate output on system multi-path devices, for
66example by \fB\-E WWN\fR.
67.TP
68.BR \-e , " \-\-exclude " \fIlist\fP
69Exclude the devices specified by the comma-separated \fIlist\fR of major device numbers.
70Note that RAM disks (major=1) are excluded by default if \fB\-\-all\fR is not specified.
71The 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.
73.TP
74.BR \-f , " \-\-fs"
75Output info about filesystems. This option is equivalent to
76.BR \-o\ NAME,FSTYPE,LABEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINT .
77The authoritative information about filesystems and raids is provided by the
78.BR blkid (8)
79command.
80.TP
81.BR \-h , " \-\-help"
82Display help text and exit.
83.TP
84.BR \-I , " \-\-include " \fIlist\fP
85Include devices specified by the comma-separated \fIlist\fR of major device numbers.
86The 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.
88.TP
89.BR \-i , " \-\-ascii"
90Use ASCII characters for tree formatting.
91.TP
92.BR \-J , " \-\-json"
93Use JSON output format. It's strongly recommended to use \fB\-\-output\fR and
94also \fB\-\-tree\fR if necessary.
95.TP
96.BR \-l , " \-\-list"
97Produce output in the form of a list. The output does not provide information
98about relationships between devices and since version 2.34 every device is
99printed only once if \fB\-\-pairs\fR or \fB\-\-raw\fR not specified (the
100parsable outputs are maintained in backwardly compatible way).
101.TP
102.BR \-M , " \-\-merge"
103Group parents of sub-trees to provide more readable output for RAIDs and
104Multi-path devices. The tree-like output is required.
105.TP
106.BR \-m , " \-\-perms"
107Output info about device owner, group and mode. This option is equivalent to
108.BR \-o\ NAME,SIZE,OWNER,GROUP,MODE .
109.TP
110.BR \-n , " \-\-noheadings"
111Do not print a header line.
112.TP
113.BR \-o , " \-\-output " \fIlist\fP
114Specify which output columns to print. Use
115.B \-\-help
116to get a list of all supported columns. The columns may affect tree-like output.
117The default is to use tree for the column 'NAME' (see also \fB\-\-tree\fR).
118
119The default list of columns may be extended if \fIlist\fP is
120specified in the format \fI+list\fP (e.g., \fBlsblk \-o +UUID\fP).
121.TP
122.BR \-O , " \-\-output\-all"
123Output all available columns.
124.TP
125.BR \-P , " \-\-pairs"
126Produce output in the form of key="value" pairs. The output lines are still ordered by
127dependencies. All potentially unsafe characters are hex-escaped (\\x<code>).
128.TP
129.BR \-p , " \-\-paths"
130Print full device paths.
131.TP
132.BR \-r , " \-\-raw"
133Produce output in raw format. The output lines are still ordered by
134dependencies. All potentially unsafe characters are hex-escaped
135(\\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT columns.
136.TP
137.BR \-S , " \-\-scsi"
138Output info about SCSI devices only. All partitions, slaves and holder devices are ignored.
139.TP
140.BR \-s , " \-\-inverse"
141Print dependencies in inverse order. If the \fB\-\-list\fR output is requested then
142the lines are still ordered by dependencies.
143.TP
144.BR \-T , " \-\-tree" [ =\fIcolumn ]
145Force tree-like output format. If \fIcolumn\fP is specified, then a tree is printed in the column.
146The default is NAME column.
147.TP
148.BR \-t , " \-\-topology"
149Output info about block-device topology.
150This option is equivalent to
151.BR \-o\ NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME .
152.TP
153.BR \-V , " \-\-version"
154Display version information and exit.
155.TP
156.BR \-x , " \-\-sort " \fIcolumn\fP
157Sort output lines by \fIcolumn\fP. This option enables \fB\-\-list\fR output format by default.
158It is possible to use the option \fI\-\-tree\fP to force tree-like output and
159than the tree branches are sorted by the \fIcolumn\fP.
160.TP
161.BR \-z , " \-\-zoned"
162Print the zone model for each device.
163.TP
164.BR " \-\-sysroot " \fIdirectory\fP
165Gather data for a Linux instance other than the instance from which the lsblk
166command is issued. The specified directory is the system root of the Linux
167instance to be inspected. The real device nodes in the target directory can
168be replaced by text files with udev attributes.
169
170.SH EXIT STATUS
171.IP 0
172success
173.IP 1
174failure
175.IP 32
176none of specified devices found
177.IP 64
178some specified devices found, some not found
179
180.SH ENVIRONMENT
181.IP LSBLK_DEBUG=all
182enables lsblk debug output.
183.IP LIBBLKID_DEBUG=all
184enables libblkid debug output.
185.IP LIBMOUNT_DEBUG=all
186enables libmount debug output.
187.IP LIBSMARTCOLS_DEBUG=all
188enables libsmartcols debug output.
189.IP LIBSMARTCOLS_DEBUG_PADDING=on
190use visible padding characters. Requires enabled LIBSMARTCOLS_DEBUG.
191.SH NOTES
192For partitions, some information (e.g., queue attributes) is inherited from the
193parent device.
194.PP
195The
196.B lsblk
197command needs to be able to look up each block device by major:minor numbers,
198which is done by using
199.IR /sys/dev/block .
200This sysfs block directory appeared in kernel 2.6.27 (October 2008).
201In case of problems with a new enough kernel, check that CONFIG_SYSFS
202was enabled at the time of the kernel build.
203
204.SH AUTHORS
205.nf
206Milan Broz <mbroz@redhat.com>
207Karel Zak <kzak@redhat.com>
208.fi
209.SH SEE ALSO
210.BR ls (1),
211.BR blkid (8),
212.BR findmnt (8)
213.SH AVAILABILITY
214The lsblk command is part of the util-linux package and is available from
215https://www.kernel.org/pub/linux/utils/util-linux/.