2013-02-25 03:48:35 -06:00
|
|
|
.TH LSBLK 8 "February 2013" "util-linux" "System Administration"
|
2010-11-24 10:06:39 -06:00
|
|
|
.SH NAME
|
|
|
|
lsblk \- list block devices
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B lsblk
|
2014-12-14 13:45:29 -06:00
|
|
|
[options]
|
2013-02-25 03:48:35 -06:00
|
|
|
.RI [ device ...]
|
2010-11-24 10:06:39 -06:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.B lsblk
|
2013-02-25 03:48:35 -06:00
|
|
|
lists information about all available or the specified block devices. The
|
2010-11-24 10:06:39 -06:00
|
|
|
.B lsblk
|
2011-02-01 14:55:54 -06:00
|
|
|
command reads the
|
2014-09-05 03:02:45 -05:00
|
|
|
.B sysfs
|
|
|
|
filesystem and
|
|
|
|
.B udev db
|
2020-07-24 05:06:15 -05:00
|
|
|
to gather information. If the udev db is not available or
|
|
|
|
.B lsblk
|
|
|
|
is compiled without udev support, then it
|
2017-11-22 05:31:58 -06:00
|
|
|
tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions
|
|
|
|
are necessary.
|
2010-11-24 10:06:39 -06:00
|
|
|
.PP
|
2011-02-01 14:55:54 -06:00
|
|
|
The command prints all block devices (except RAM disks) in a tree-like format
|
|
|
|
by default. Use
|
2019-12-15 18:51:57 -06:00
|
|
|
.B "lsblk \-\-help"
|
2011-02-01 14:55:54 -06:00
|
|
|
to get a list of all available columns.
|
2012-07-26 04:44:59 -05:00
|
|
|
.PP
|
2013-02-25 03:48:35 -06:00
|
|
|
The default output, as well as the default output from options like
|
2018-05-18 14:21:42 -05:00
|
|
|
.B \-\-fs
|
2013-02-25 03:48:35 -06:00
|
|
|
and
|
|
|
|
.BR \-\-topology ,
|
|
|
|
is subject to change. So whenever possible, you should avoid using default
|
|
|
|
outputs in your scripts. Always explicitly define expected columns by using
|
2012-07-26 04:44:59 -05:00
|
|
|
.B \-\-output
|
2013-02-25 03:48:35 -06:00
|
|
|
.I columns-list
|
2019-02-20 05:49:24 -06:00
|
|
|
and
|
|
|
|
.B \-\-list
|
2013-02-25 03:48:35 -06:00
|
|
|
in environments where a stable output is required.
|
2014-09-05 03:02:45 -05:00
|
|
|
.PP
|
|
|
|
Note that
|
|
|
|
.B lsblk
|
|
|
|
might be executed in time when
|
|
|
|
.B udev
|
|
|
|
does not have all information about recently added or modified devices yet. In this
|
|
|
|
case it is recommended to use
|
|
|
|
.B "udevadm settle"
|
2020-07-24 05:06:15 -05:00
|
|
|
before
|
|
|
|
.B lsblk
|
|
|
|
to synchronize with udev.
|
2010-11-24 10:06:39 -06:00
|
|
|
.SH OPTIONS
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
|
|
|
.BR \-a , " \-\-all"
|
2018-05-15 03:51:15 -05:00
|
|
|
Also list empty devices and RAM disk devices.
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
|
|
|
.BR \-b , " \-\-bytes"
|
|
|
|
Print the SIZE column in bytes rather than in a human-readable format.
|
|
|
|
.TP
|
|
|
|
.BR \-D , " \-\-discard"
|
|
|
|
Print information about the discarding capabilities (TRIM, UNMAP) for each device.
|
|
|
|
.TP
|
|
|
|
.BR \-d , " \-\-nodeps"
|
2019-12-15 18:51:57 -06:00
|
|
|
Do not print holder devices or slaves. For example, \fBlsblk \-\-nodeps /dev/sda\fR prints
|
2010-12-16 05:47:30 -06:00
|
|
|
information about the sda device only.
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
2018-12-07 05:29:50 -06:00
|
|
|
.BR \-E , " \-\-dedup " \fIcolumn\fP
|
|
|
|
Use \fIcolumn\fP as a de-duplication key to de-duplicate output tree. If the
|
|
|
|
key is not available for the device, or the device is a partition and parental
|
|
|
|
whole-disk device provides the same key than the device is always printed.
|
|
|
|
|
|
|
|
The usual use case is to de-duplicate output on system multi-path devices, for
|
|
|
|
example by \fB\-E WWN\fR.
|
|
|
|
.TP
|
2013-02-25 03:48:35 -06:00
|
|
|
.BR \-e , " \-\-exclude " \fIlist\fP
|
|
|
|
Exclude the devices specified by the comma-separated \fIlist\fR of major device numbers.
|
2019-05-13 13:53:16 -05:00
|
|
|
Note that RAM disks (major=1) are excluded by default if \fB\-\-all\fR is not specified.
|
|
|
|
The filter is applied to the top-level devices only. This may be confusing for
|
2018-07-18 09:21:01 -05:00
|
|
|
\fB\-\-list\fR output format where hierarchy of the devices is not obvious.
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
|
|
|
.BR \-f , " \-\-fs"
|
|
|
|
Output info about filesystems. This option is equivalent to
|
2019-12-15 18:51:57 -06:00
|
|
|
.BR \-o\ NAME,FSTYPE,LABEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINT .
|
2011-02-01 14:55:54 -06:00
|
|
|
The authoritative information about filesystems and raids is provided by the
|
2010-11-24 10:06:39 -06:00
|
|
|
.BR blkid (8)
|
|
|
|
command.
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
|
|
|
.BR \-h , " \-\-help"
|
2013-10-14 14:34:39 -05:00
|
|
|
Display help text and exit.
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
|
|
|
.BR \-I , " \-\-include " \fIlist\fP
|
|
|
|
Include devices specified by the comma-separated \fIlist\fR of major device numbers.
|
2019-05-13 13:53:16 -05:00
|
|
|
The filter is applied to the top-level devices only. This may be confusing for
|
2018-07-18 09:21:01 -05:00
|
|
|
\fB\-\-list\fR output format where hierarchy of the devices is not obvious.
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
|
|
|
.BR \-i , " \-\-ascii"
|
2011-05-10 03:38:29 -05:00
|
|
|
Use ASCII characters for tree formatting.
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
2015-06-04 08:49:52 -05:00
|
|
|
.BR \-J , " \-\-json"
|
2019-03-18 10:58:41 -05:00
|
|
|
Use JSON output format. It's strongly recommended to use \fB\-\-output\fR and
|
|
|
|
also \fB\-\-tree\fR if necessary.
|
2015-06-04 08:49:52 -05:00
|
|
|
.TP
|
2013-02-25 03:48:35 -06:00
|
|
|
.BR \-l , " \-\-list"
|
2018-12-07 05:29:50 -06:00
|
|
|
Produce output in the form of a list. The output does not provide information
|
|
|
|
about relationships between devices and since version 2.34 every device is
|
2020-02-25 08:31:23 -06:00
|
|
|
printed only once if \fB\-\-pairs\fR or \fB\-\-raw\fR not specified (the
|
|
|
|
parsable outputs are maintained in backwardly compatible way).
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
2018-12-07 05:29:50 -06:00
|
|
|
.BR \-M , " \-\-merge"
|
|
|
|
Group parents of sub-trees to provide more readable output for RAIDs and
|
|
|
|
Multi-path devices. The tree-like output is required.
|
2018-10-18 08:46:07 -05:00
|
|
|
.TP
|
2013-02-25 03:48:35 -06:00
|
|
|
.BR \-m , " \-\-perms"
|
|
|
|
Output info about device owner, group and mode. This option is equivalent to
|
2019-12-15 18:51:57 -06:00
|
|
|
.BR \-o\ NAME,SIZE,OWNER,GROUP,MODE .
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
|
|
|
.BR \-n , " \-\-noheadings"
|
2010-11-24 10:06:39 -06:00
|
|
|
Do not print a header line.
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
|
|
|
.BR \-o , " \-\-output " \fIlist\fP
|
2011-02-01 14:55:54 -06:00
|
|
|
Specify which output columns to print. Use
|
2013-02-25 03:48:35 -06:00
|
|
|
.B \-\-help
|
2019-03-18 10:58:41 -05:00
|
|
|
to get a list of all supported columns. The columns may affect tree-like output.
|
|
|
|
The default is to use tree for the column 'NAME' (see also \fB\-\-tree\fR).
|
2013-02-18 06:30:00 -06:00
|
|
|
|
2013-02-22 14:51:32 -06:00
|
|
|
The default list of columns may be extended if \fIlist\fP is
|
2019-12-15 18:51:57 -06:00
|
|
|
specified in the format \fI+list\fP (e.g., \fBlsblk \-o +UUID\fP).
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
2020-05-14 18:51:29 -05:00
|
|
|
.BR \-O , " \-\-output\-all"
|
2014-04-27 00:18:41 -05:00
|
|
|
Output all available columns.
|
|
|
|
.TP
|
2013-02-25 03:48:35 -06:00
|
|
|
.BR \-P , " \-\-pairs"
|
2020-02-25 08:31:23 -06:00
|
|
|
Produce output in the form of key="value" pairs. The output lines are still ordered by
|
|
|
|
dependencies. All potentially unsafe characters are hex-escaped (\\x<code>).
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
2013-03-29 11:16:02 -05:00
|
|
|
.BR \-p , " \-\-paths"
|
|
|
|
Print full device paths.
|
|
|
|
.TP
|
2013-02-25 03:48:35 -06:00
|
|
|
.BR \-r , " \-\-raw"
|
2020-02-25 08:31:23 -06:00
|
|
|
Produce output in raw format. The output lines are still ordered by
|
|
|
|
dependencies. All potentially unsafe characters are hex-escaped
|
2013-02-25 03:48:35 -06:00
|
|
|
(\\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT columns.
|
|
|
|
.TP
|
|
|
|
.BR \-S , " \-\-scsi"
|
|
|
|
Output info about SCSI devices only. All partitions, slaves and holder devices are ignored.
|
|
|
|
.TP
|
|
|
|
.BR \-s , " \-\-inverse"
|
2017-04-13 04:39:22 -05:00
|
|
|
Print dependencies in inverse order. If the \fB\-\-list\fR output is requested then
|
|
|
|
the lines are still ordered by dependencies.
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
2019-02-20 05:49:24 -06:00
|
|
|
.BR \-T , " \-\-tree" [ =\fIcolumn ]
|
|
|
|
Force tree-like output format. If \fIcolumn\fP is specified, then a tree is printed in the column.
|
|
|
|
The default is NAME column.
|
|
|
|
.TP
|
2013-02-25 03:48:35 -06:00
|
|
|
.BR \-t , " \-\-topology"
|
|
|
|
Output info about block-device topology.
|
|
|
|
This option is equivalent to
|
2019-12-15 18:51:57 -06:00
|
|
|
.BR \-o\ NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME .
|
2013-02-25 03:48:35 -06:00
|
|
|
.TP
|
|
|
|
.BR \-V , " \-\-version"
|
2013-10-14 14:34:39 -05:00
|
|
|
Display version information and exit.
|
2014-05-20 08:08:08 -05:00
|
|
|
.TP
|
|
|
|
.BR \-x , " \-\-sort " \fIcolumn\fP
|
2017-06-09 04:33:18 -05:00
|
|
|
Sort output lines by \fIcolumn\fP. This option enables \fB\-\-list\fR output format by default.
|
|
|
|
It is possible to use the option \fI\-\-tree\fP to force tree-like output and
|
|
|
|
than the tree branches are sorted by the \fIcolumn\fP.
|
2018-06-19 09:30:29 -05:00
|
|
|
.TP
|
2018-12-07 05:29:50 -06:00
|
|
|
.BR \-z , " \-\-zoned"
|
|
|
|
Print the zone model for each device.
|
|
|
|
.TP
|
2018-06-19 09:30:29 -05:00
|
|
|
.BR " \-\-sysroot " \fIdirectory\fP
|
2020-07-24 05:06:15 -05:00
|
|
|
Gather data for a Linux instance other than the instance from which the
|
|
|
|
.B lsblk
|
2018-06-19 09:30:29 -05:00
|
|
|
command is issued. The specified directory is the system root of the Linux
|
2019-10-15 06:08:09 -05:00
|
|
|
instance to be inspected. The real device nodes in the target directory can
|
|
|
|
be replaced by text files with udev attributes.
|
2018-06-19 09:30:29 -05:00
|
|
|
|
2020-05-19 07:53:21 -05:00
|
|
|
.SH EXIT STATUS
|
2015-01-29 05:35:26 -06:00
|
|
|
.IP 0
|
|
|
|
success
|
|
|
|
.IP 1
|
|
|
|
failure
|
|
|
|
.IP 32
|
2017-09-07 03:03:18 -05:00
|
|
|
none of specified devices found
|
2015-01-29 05:35:26 -06:00
|
|
|
.IP 64
|
|
|
|
some specified devices found, some not found
|
|
|
|
|
2012-09-04 08:58:06 -05:00
|
|
|
.SH ENVIRONMENT
|
2018-02-16 12:10:35 -06:00
|
|
|
.IP LSBLK_DEBUG=all
|
2020-07-24 05:06:15 -05:00
|
|
|
enables
|
|
|
|
.B lsblk
|
|
|
|
debug output.
|
2014-11-03 06:13:54 -06:00
|
|
|
.IP LIBBLKID_DEBUG=all
|
|
|
|
enables libblkid debug output.
|
|
|
|
.IP LIBMOUNT_DEBUG=all
|
|
|
|
enables libmount debug output.
|
|
|
|
.IP LIBSMARTCOLS_DEBUG=all
|
|
|
|
enables libsmartcols debug output.
|
2016-09-07 05:25:06 -05:00
|
|
|
.IP LIBSMARTCOLS_DEBUG_PADDING=on
|
|
|
|
use visible padding characters. Requires enabled LIBSMARTCOLS_DEBUG.
|
Manual pages: order NOTES / HISTORY / BUGS / EXAMPLE consistently
There is value in ensuring that manual page sections use consistently
named sections, as far as possible, and also that sections have a
consistent order within manual pages. This is one of a series of patches
to place manual page sections in a consistent order.
In this patch, we ensure that the NOTES, HISTORY, BUGS, and EXAMPLE
sections are always placed near the end of the page, just above
AUTHORS, COPYRIGHT, SEE ALSO, and AVAILABILITY.
One page is not fixed by this patch: term-utils/agetty.8. This page
is a mess of unusual section names, and probably requires an individual
edit.
Testing that no gross editing mistake (causing accidental loss or addition
of text) was performed as follows:
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > a
[Apply patch]
$ cat $(grep '\.SH' -l $(find . -name '*.[1-9]') |sort) | sort > b
$ diff a b
$ echo $?
0
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 02:28:32 -05:00
|
|
|
.SH NOTES
|
|
|
|
For partitions, some information (e.g., queue attributes) is inherited from the
|
|
|
|
parent device.
|
|
|
|
.PP
|
|
|
|
The
|
|
|
|
.B lsblk
|
|
|
|
command needs to be able to look up each block device by major:minor numbers,
|
|
|
|
which is done by using
|
|
|
|
.IR /sys/dev/block .
|
|
|
|
This sysfs block directory appeared in kernel 2.6.27 (October 2008).
|
|
|
|
In case of problems with a new enough kernel, check that CONFIG_SYSFS
|
|
|
|
was enabled at the time of the kernel build.
|
|
|
|
|
2020-05-21 02:28:21 -05:00
|
|
|
.SH AUTHORS
|
|
|
|
.nf
|
|
|
|
Milan Broz <mbroz@redhat.com>
|
|
|
|
Karel Zak <kzak@redhat.com>
|
|
|
|
.fi
|
2010-11-24 10:06:39 -06:00
|
|
|
.SH SEE ALSO
|
2016-11-10 04:59:27 -06:00
|
|
|
.BR ls (1),
|
2010-11-24 10:06:39 -06:00
|
|
|
.BR blkid (8),
|
2016-11-10 04:59:27 -06:00
|
|
|
.BR findmnt (8)
|
2010-11-24 10:06:39 -06:00
|
|
|
.SH AVAILABILITY
|
2010-11-30 04:41:59 -06:00
|
|
|
The lsblk command is part of the util-linux package and is available from
|
2016-12-17 02:06:57 -06:00
|
|
|
https://www.kernel.org/pub/linux/utils/util-linux/.
|