1LSBLK(8)                     System Administration                    LSBLK(8)
2
3
4

NAME

6       lsblk - list block devices
7

SYNOPSIS

9       lsblk [options] [device...]
10

DESCRIPTION

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

OPTIONS

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. This maybe be confusing
58              for --list output format where hierarchy of the devices  is  not
59              obvious.
60
61       -f, --fs
62              Output  info  about  filesystems.   This option is equivalent to
63              -o NAME,FSTYPE,LABEL,UUID,MOUNTPOINT.  The authoritative  infor‐
64              mation  about  filesystems and raids is provided by the blkid(8)
65              command.
66
67       -h, --help
68              Display help text and exit.
69
70       -I, --include list
71              Include devices specified by the comma-separated list  of  major
72              device  numbers.  The filter is applied to the top-level devices
73              only. This maybe be confusing for  --list  output  format  where
74              hierarchy of the devices is not obvious.
75
76       -i, --ascii
77              Use ASCII characters for tree formatting.
78
79       -J, --json
80              Use JSON output format.
81
82       -l, --list
83              Produce output in the form of a list.
84
85       -m, --perms
86              Output  info about device owner, group and mode.  This option is
87              equivalent to -o NAME,SIZE,OWNER,GROUP,MODE.
88
89       -n, --noheadings
90              Do not print a header line.
91
92       -o, --output list
93              Specify which output columns to print.  Use --help to get a list
94              of all supported columns.
95
96              The default list of columns may be extended if list is specified
97              in the format +list (e.g. lsblk -o +UUID).
98
99       -O, --output-all
100              Output all available columns.
101
102       -P, --pairs
103              Produce output in the form of  key="value"  pairs.   All  poten‐
104              tially unsafe characters are hex-escaped (\x<code>).
105
106       -p, --paths
107              Print full device paths.
108
109       -r, --raw
110              Produce output in raw format.  All potentially unsafe characters
111              are hex-escaped (\x<code>) in the NAME, KNAME, LABEL,  PARTLABEL
112              and MOUNTPOINT columns.
113
114       -S, --scsi
115              Output info about SCSI devices only.  All partitions, slaves and
116              holder devices are ignored.
117
118       -s, --inverse
119              Print dependencies in inverse order. If  the  --list  output  is
120              requested then the lines are still ordered by dependencies.
121
122       -t, --topology
123              Output info about block-device topology.  This option is equiva‐
124              lent       to       -o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-
125              SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME.
126
127       -V, --version
128              Display version information and exit.
129
130       -x, --sort column
131              Sort  output  lines by column. This option enables --list output
132              format by default.  It is possible to use the option  --tree  to
133              force  tree-like output and than the tree branches are sorted by
134              the column.
135
136        --sysroot directory
137              Gather data for a Linux instance other than  the  instance  from
138              which  the  lsblk command is issued.  The specified directory is
139              the system root of the Linux instance  to  be  inspected.   This
140              option is designed for the testing purpose.
141
142

NOTES

144       For  partitions,  some information (e.g. queue attributes) is inherited
145       from the parent device.
146
147       The lsblk command needs to be able to look  up  each  block  device  by
148       major:minor numbers, which is done by using /sys/dev/block.  This sysfs
149       block directory appeared in kernel 2.6.27 (October 2008).  In  case  of
150       problems  with a new enough kernel, check that CONFIG_SYSFS was enabled
151       at the time of the kernel build.
152
153

RETURN CODES

155       0      success
156
157       1      failure
158
159       32     none of specified devices found
160
161       64     some specified devices found, some not found
162
163

AUTHORS

165       Milan Broz <mbroz@redhat.com>
166       Karel Zak <kzak@redhat.com>
167

ENVIRONMENT

169       LSBLK_DEBUG=all
170              enables lsblk debug output.
171
172       LIBBLKID_DEBUG=all
173              enables libblkid debug output.
174
175       LIBMOUNT_DEBUG=all
176              enables libmount debug output.
177
178       LIBSMARTCOLS_DEBUG=all
179              enables libsmartcols debug output.
180
181       LIBSMARTCOLS_DEBUG_PADDING=on
182              use  visible  padding  characters.  Requires  enabled  LIBSMART‐
183              COLS_DEBUG.
184

SEE ALSO

186       ls(1), blkid(8), findmnt(8)
187

AVAILABILITY

189       The  lsblk  command  is part of the util-linux package and is available
190       from https://www.kernel.org/pub/linux/utils/util-linux/.
191
192
193
194util-linux                       February 2013                        LSBLK(8)
Impressum