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