]> git.ipfire.org Git - thirdparty/util-linux.git/blob - misc-utils/lsblk.8
docs: replace FTP by HTTPS in kernel.org URLs
[thirdparty/util-linux.git] / misc-utils / lsblk.8
1 .TH LSBLK 8 "February 2013" "util-linux" "System Administration"
2 .SH NAME
3 lsblk \- list block devices
4 .SH SYNOPSIS
5 .B lsblk
6 [options]
7 .RI [ device ...]
8 .SH DESCRIPTION
9 .B lsblk
10 lists information about all available or the specified block devices. The
11 .B lsblk
12 command reads the
13 .B sysfs
14 filesystem and
15 .B udev db
16 to gather information.
17 .PP
18 The command prints all block devices (except RAM disks) in a tree-like format
19 by default. Use
20 .B "lsblk --help"
21 to get a list of all available columns.
22 .PP
23 The default output, as well as the default output from options like
24 .BR \-\-fs
25 and
26 .BR \-\-topology ,
27 is subject to change. So whenever possible, you should avoid using default
28 outputs in your scripts. Always explicitly define expected columns by using
29 .B \-\-output
30 .I columns-list
31 in environments where a stable output is required.
32 .PP
33 Note that
34 .B lsblk
35 might be executed in time when
36 .B udev
37 does not have all information about recently added or modified devices yet. In this
38 case it is recommended to use
39 .B "udevadm settle"
40 before lsblk to synchronize with udev.
41 .SH OPTIONS
42 .TP
43 .BR \-a , " \-\-all"
44 Also list empty devices. (By default they are skipped.)
45 .TP
46 .BR \-b , " \-\-bytes"
47 Print the SIZE column in bytes rather than in a human-readable format.
48 .TP
49 .BR \-D , " \-\-discard"
50 Print information about the discarding capabilities (TRIM, UNMAP) for each device.
51 .TP
52 .BR \-d , " \-\-nodeps"
53 Do not print holder devices or slaves. For example, \fBlsblk --nodeps /dev/sda\fR prints
54 information about the sda device only.
55 .TP
56 .BR \-e , " \-\-exclude " \fIlist\fP
57 Exclude the devices specified by the comma-separated \fIlist\fR of major device numbers.
58 Note that RAM disks (major=1) are excluded by default. The filter is applied to the
59 top-level devices only.
60 .TP
61 .BR \-f , " \-\-fs"
62 Output info about filesystems. This option is equivalent to
63 .BR -o\ NAME,FSTYPE,LABEL,UUID,MOUNTPOINT .
64 The authoritative information about filesystems and raids is provided by the
65 .BR blkid (8)
66 command.
67 .TP
68 .BR \-h , " \-\-help"
69 Display help text and exit.
70 .TP
71 .BR \-I , " \-\-include " \fIlist\fP
72 Include devices specified by the comma-separated \fIlist\fR of major device numbers.
73 The filter is applied to the top-level devices only.
74 .TP
75 .BR \-i , " \-\-ascii"
76 Use ASCII characters for tree formatting.
77 .TP
78 .BR \-J , " \-\-json"
79 Use JSON output format.
80 .TP
81 .BR \-l , " \-\-list"
82 Produce output in the form of a list.
83 .TP
84 .BR \-m , " \-\-perms"
85 Output info about device owner, group and mode. This option is equivalent to
86 .BR -o\ NAME,SIZE,OWNER,GROUP,MODE .
87 .TP
88 .BR \-n , " \-\-noheadings"
89 Do not print a header line.
90 .TP
91 .BR \-o , " \-\-output " \fIlist\fP
92 Specify which output columns to print. Use
93 .B \-\-help
94 to get a list of all supported columns.
95
96 The default list of columns may be extended if \fIlist\fP is
97 specified in the format \fI+list\fP (e.g. \fBlsblk -o +UUID\fP).
98 .TP
99 .BR \-O , " \-\-output\-all "
100 Output all available columns.
101 .TP
102 .BR \-P , " \-\-pairs"
103 Produce output in the form of key="value" pairs.
104 All potentially unsafe characters are hex-escaped (\\x<code>).
105 .TP
106 .BR \-p , " \-\-paths"
107 Print full device paths.
108 .TP
109 .BR \-r , " \-\-raw"
110 Produce output in raw format. All potentially unsafe characters are hex-escaped
111 (\\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT columns.
112 .TP
113 .BR \-S , " \-\-scsi"
114 Output info about SCSI devices only. All partitions, slaves and holder devices are ignored.
115 .TP
116 .BR \-s , " \-\-inverse"
117 Print dependencies in inverse order.
118 .TP
119 .BR \-t , " \-\-topology"
120 Output info about block-device topology.
121 This option is equivalent to
122 .BR -o\ NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME .
123 .TP
124 .BR \-V , " \-\-version"
125 Display version information and exit.
126 .TP
127 .BR \-x , " \-\-sort " \fIcolumn\fP
128 Sort output lines by \fIcolumn\fP. This option enables \fB\-\-list\fR output.
129 .SH NOTES
130 For partitions, some information (e.g. queue attributes) is inherited from the
131 parent device.
132 .PP
133 The
134 .B lsblk
135 command needs to be able to look up each block device by major:minor numbers,
136 which is done by using
137 .IR /sys/dev/block .
138 This sysfs block directory appeared in kernel 2.6.27 (October 2008).
139 In case of problems with a new enough kernel, check that CONFIG_SYSFS
140 was enabled at the time of the kernel build.
141
142 .SH RETURN CODES
143 .IP 0
144 success
145 .IP 1
146 failure
147 .IP 32
148 not found all specified devices
149 .IP 64
150 some specified devices found, some not found
151
152 .SH AUTHORS
153 .nf
154 Milan Broz <mbroz@redhat.com>
155 Karel Zak <kzak@redhat.com>
156 .fi
157 .SH ENVIRONMENT
158 .IP LIBBLKID_DEBUG=all
159 enables libblkid debug output.
160 .IP LIBMOUNT_DEBUG=all
161 enables libmount debug output.
162 .IP LIBSMARTCOLS_DEBUG=all
163 enables libsmartcols debug output.
164 .IP LIBSMARTCOLS_DEBUG_PADDING=on
165 use visible padding characters. Requires enabled LIBSMARTCOLS_DEBUG.
166 .SH SEE ALSO
167 .BR ls (1),
168 .BR blkid (8),
169 .BR findmnt (8)
170 .SH AVAILABILITY
171 The lsblk command is part of the util-linux package and is available from
172 https://www.kernel.org/pub/linux/utils/util-linux/.