327 lines
9.2 KiB
HTML
327 lines
9.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of LSBLK</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>LSBLK</H1>
|
|
Section: System Administration (8)<BR>Updated: February 2013<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
lsblk - list block devices
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>lsblk</B>
|
|
|
|
[options]
|
|
[<I>device</I>...]
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>lsblk</B>
|
|
|
|
lists information about all available or the specified block devices. The
|
|
<B>lsblk</B>
|
|
|
|
command reads the
|
|
<B>sysfs</B>
|
|
|
|
filesystem and
|
|
<B>udev db</B>
|
|
|
|
to gather information. If the udev db is not available or lsblk is compiled without udev support than it
|
|
tries to read LABELs, UUIDs and filesystem types from the block device. In this case root permissions
|
|
are necessary.
|
|
<P>
|
|
|
|
The command prints all block devices (except RAM disks) in a tree-like format
|
|
by default. Use
|
|
<B>lsblk --help</B>
|
|
|
|
to get a list of all available columns.
|
|
<P>
|
|
|
|
The default output, as well as the default output from options like
|
|
<B>--fs</B>
|
|
|
|
and
|
|
<B>--topology</B>,
|
|
|
|
is subject to change. So whenever possible, you should avoid using default
|
|
outputs in your scripts. Always explicitly define expected columns by using
|
|
<B>--output</B>
|
|
|
|
<I>columns-list</I>
|
|
|
|
and
|
|
<B>--list</B>
|
|
|
|
in environments where a stable output is required.
|
|
<P>
|
|
|
|
Note that
|
|
<B>lsblk</B>
|
|
|
|
might be executed in time when
|
|
<B>udev</B>
|
|
|
|
does not have all information about recently added or modified devices yet. In this
|
|
case it is recommended to use
|
|
<B>udevadm settle</B>
|
|
|
|
before lsblk to synchronize with udev.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-a</B>,<B> --all</B>
|
|
|
|
<DD>
|
|
Also list empty devices and RAM disk devices.
|
|
<DT id="2"><B>-b</B>,<B> --bytes</B>
|
|
|
|
<DD>
|
|
Print the SIZE column in bytes rather than in a human-readable format.
|
|
<DT id="3"><B>-D</B>,<B> --discard</B>
|
|
|
|
<DD>
|
|
Print information about the discarding capabilities (TRIM, UNMAP) for each device.
|
|
<DT id="4"><B>-d</B>,<B> --nodeps</B>
|
|
|
|
<DD>
|
|
Do not print holder devices or slaves. For example, <B>lsblk --nodeps /dev/sda</B> prints
|
|
information about the sda device only.
|
|
<DT id="5"><B>-E</B>,<B> --dedup </B><I>column</I>
|
|
|
|
<DD>
|
|
Use <I>column</I> 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.
|
|
<P>
|
|
The usual use case is to de-duplicate output on system multi-path devices, for
|
|
example by <B>-E WWN</B>.
|
|
<DT id="6"><B>-e</B>,<B> --exclude </B><I>list</I>
|
|
|
|
<DD>
|
|
Exclude the devices specified by the comma-separated <I>list</I> of major device numbers.
|
|
Note that RAM disks (major=1) are excluded by default if <B>--all</B> is not specified.
|
|
The filter is applied to the top-level devices only. This may be confusing for
|
|
<B>--list</B> output format where hierarchy of the devices is not obvious.
|
|
<DT id="7"><B>-f</B>,<B> --fs</B>
|
|
|
|
<DD>
|
|
Output info about filesystems. This option is equivalent to
|
|
<B>-o NAME,FSTYPE,LABEL,UUID,MOUNTPOINT</B>.
|
|
|
|
The authoritative information about filesystems and raids is provided by the
|
|
<B><A HREF="/cgi-bin/man/man2html?8+blkid">blkid</A></B>(8)
|
|
|
|
command.
|
|
<DT id="8"><B>-h</B>,<B> --help</B>
|
|
|
|
<DD>
|
|
Display help text and exit.
|
|
<DT id="9"><B>-I</B>,<B> --include </B><I>list</I>
|
|
|
|
<DD>
|
|
Include devices specified by the comma-separated <I>list</I> of major device numbers.
|
|
The filter is applied to the top-level devices only. This may be confusing for
|
|
<B>--list</B> output format where hierarchy of the devices is not obvious.
|
|
<DT id="10"><B>-i</B>,<B> --ascii</B>
|
|
|
|
<DD>
|
|
Use ASCII characters for tree formatting.
|
|
<DT id="11"><B>-J</B>,<B> --json</B>
|
|
|
|
<DD>
|
|
Use JSON output format. It's strongly recommended to use <B>--output</B> and
|
|
also <B>--tree</B> if necessary.
|
|
<DT id="12"><B>-l</B>,<B> --list</B>
|
|
|
|
<DD>
|
|
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
|
|
printed only once.
|
|
<DT id="13"><B>-M</B>,<B> --merge</B>
|
|
|
|
<DD>
|
|
Group parents of sub-trees to provide more readable output for RAIDs and
|
|
Multi-path devices. The tree-like output is required.
|
|
<DT id="14"><B>-m</B>,<B> --perms</B>
|
|
|
|
<DD>
|
|
Output info about device owner, group and mode. This option is equivalent to
|
|
<B>-o NAME,SIZE,OWNER,GROUP,MODE</B>.
|
|
|
|
<DT id="15"><B>-n</B>,<B> --noheadings</B>
|
|
|
|
<DD>
|
|
Do not print a header line.
|
|
<DT id="16"><B>-o</B>,<B> --output </B><I>list</I>
|
|
|
|
<DD>
|
|
Specify which output columns to print. Use
|
|
<B>--help</B>
|
|
|
|
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 <B>--tree</B>).
|
|
<P>
|
|
The default list of columns may be extended if <I>list</I> is
|
|
specified in the format <I>+list</I> (e.g. <B>lsblk -o +UUID</B>).
|
|
<DT id="17"><B>-O</B>,<B> --output-all </B>
|
|
|
|
<DD>
|
|
Output all available columns.
|
|
<DT id="18"><B>-P</B>,<B> --pairs</B>
|
|
|
|
<DD>
|
|
Produce output in the form of key="value" pairs.
|
|
All potentially unsafe characters are hex-escaped (\x<code>).
|
|
<DT id="19"><B>-p</B>,<B> --paths</B>
|
|
|
|
<DD>
|
|
Print full device paths.
|
|
<DT id="20"><B>-r</B>,<B> --raw</B>
|
|
|
|
<DD>
|
|
Produce output in raw format. All potentially unsafe characters are hex-escaped
|
|
(\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT columns.
|
|
<DT id="21"><B>-S</B>,<B> --scsi</B>
|
|
|
|
<DD>
|
|
Output info about SCSI devices only. All partitions, slaves and holder devices are ignored.
|
|
<DT id="22"><B>-s</B>,<B> --inverse</B>
|
|
|
|
<DD>
|
|
Print dependencies in inverse order. If the <B>--list</B> output is requested then
|
|
the lines are still ordered by dependencies.
|
|
<DT id="23"><B>-T</B>,<B> --tree</B>[<B>=</B><I>column</I>]
|
|
|
|
<DD>
|
|
Force tree-like output format. If <I>column</I> is specified, then a tree is printed in the column.
|
|
The default is NAME column.
|
|
<DT id="24"><B>-t</B>,<B> --topology</B>
|
|
|
|
<DD>
|
|
Output info about block-device topology.
|
|
This option is equivalent to
|
|
<B>-o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME</B>.
|
|
|
|
<DT id="25"><B>-V</B>,<B> --version</B>
|
|
|
|
<DD>
|
|
Display version information and exit.
|
|
<DT id="26"><B>-x</B>,<B> --sort </B><I>column</I>
|
|
|
|
<DD>
|
|
Sort output lines by <I>column</I>. This option enables <B>--list</B> output format by default.
|
|
It is possible to use the option <I>--tree</I> to force tree-like output and
|
|
than the tree branches are sorted by the <I>column</I>.
|
|
<DT id="27"><B>-z</B>,<B> --zoned</B>
|
|
|
|
<DD>
|
|
Print the zone model for each device.
|
|
<DT id="28"><B> --sysroot </B><I>directory</I>
|
|
|
|
<DD>
|
|
Gather data for a Linux instance other than the instance from which the lsblk
|
|
command is issued. The specified directory is the system root of the Linux
|
|
instance to be inspected. This option is designed for the testing purpose.
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
For partitions, some information (e.g. queue attributes) is inherited from the
|
|
parent device.
|
|
<P>
|
|
|
|
The
|
|
<B>lsblk</B>
|
|
|
|
command needs to be able to look up each block device by major:minor numbers,
|
|
which is done by using
|
|
<I>/sys/dev/block</I>.
|
|
|
|
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.
|
|
<P>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>RETURN CODES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="29">0<DD>
|
|
success
|
|
<DT id="30">1<DD>
|
|
failure
|
|
<DT id="31">32<DD>
|
|
none of specified devices found
|
|
<DT id="32">64<DD>
|
|
some specified devices found, some not found
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>AUTHORS</H2>
|
|
|
|
<PRE>
|
|
Milan Broz <<A HREF="mailto:mbroz@redhat.com">mbroz@redhat.com</A>>
|
|
Karel Zak <<A HREF="mailto:kzak@redhat.com">kzak@redhat.com</A>>
|
|
</PRE>
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>ENVIRONMENT</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="33">LSBLK_DEBUG=all<DD>
|
|
enables lsblk debug output.
|
|
<DT id="34">LIBBLKID_DEBUG=all<DD>
|
|
enables libblkid debug output.
|
|
<DT id="35">LIBMOUNT_DEBUG=all<DD>
|
|
enables libmount debug output.
|
|
<DT id="36">LIBSMARTCOLS_DEBUG=all<DD>
|
|
enables libsmartcols debug output.
|
|
<DT id="37">LIBSMARTCOLS_DEBUG_PADDING=on<DD>
|
|
use visible padding characters. Requires enabled LIBSMARTCOLS_DEBUG.
|
|
</DL>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ls">ls</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+blkid">blkid</A></B>(8),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+findmnt">findmnt</A></B>(8)
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>AVAILABILITY</H2>
|
|
|
|
The lsblk command is part of the util-linux package and is available from
|
|
<A HREF="https://www.kernel.org/pub/linux/utils/util-linux/.">https://www.kernel.org/pub/linux/utils/util-linux/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="38"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="39"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="40"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="41"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="42"><A HREF="#lbAF">NOTES</A><DD>
|
|
<DT id="43"><A HREF="#lbAG">RETURN CODES</A><DD>
|
|
<DT id="44"><A HREF="#lbAH">AUTHORS</A><DD>
|
|
<DT id="45"><A HREF="#lbAI">ENVIRONMENT</A><DD>
|
|
<DT id="46"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="47"><A HREF="#lbAK">AVAILABILITY</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:13 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|