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