Update to upstream util-linux 2.20.1
[framework/base/util-linux-ng.git] / misc-utils / blkid.8
1 .\" Copyright 2000 Andreas Dilger (adilger@turbolinux.com)
2 .\"
3 .\" This man page was created for blkid from e2fsprogs-1.25.
4 .\"
5 .\" This file may be copied under the terms of the GNU Public License.
6 .\"
7 .\" Based on uuidgen, Mon Sep 17 10:42:12 2000, Andreas Dilger
8 .TH BLKID 8 "February 2011" "util-linux" "System Administration"
9 .SH NAME
10 blkid \- locate/print block device attributes
11 .SH SYNOPSIS
12 .B blkid
13 .RB \-L
14 .IR label " | "
15 .RB \-U
16 .IR uuid
17
18 .B blkid
19 .RB [ \-dghlv ]
20 .RB [ \-c
21 .IR file ]
22 .RB [ \-w
23 .IR file ]
24 .RB [ \-o
25 .IR format ]
26 .in +6
27 .RB [ \-s
28 .IR tag ]
29 .RB [ \-t
30 .IR NAME=value ]
31 [\fIdevice\fR ...]
32 .in -6
33
34 .B blkid
35 .RB -p
36 .RB [ \-O
37 .IR offset ]
38 .RB [ \-S
39 .IR size ]
40 .RB [ \-o
41 .IR format ]
42 .RB [ \-s
43 .IR tag ]
44 .in +9
45 .RB [ \-n
46 .IR list ]
47 .RB [ \-u
48 .IR list ]
49 .IR device " ... "
50 .in -9
51
52 .B blkid
53 .RB -i
54 .RB [ \-o
55 .IR format ]
56 .RB [ \-s
57 .IR tag ]
58 .IR device " ... "
59
60 .SH DESCRIPTION
61 The
62 .B blkid
63 program is the command-line interface to working with the
64 .BR libblkid (3)
65 library.  It can determine the type of content (e.g. filesystem or swap)
66 that a block device holds, and also attributes (tokens, NAME=value pairs)
67 from the content metadata (e.g. LABEL or UUID fields).
68 .PP
69 .B blkid
70 has two main forms of operation: either searching for a device with a
71 specific NAME=value pair, or displaying NAME=value pairs for one or
72 more specified devices.
73 .SH OPTIONS
74 The \fIsize\fR and \fIoffset\fR arguments may be followed by binary (2^N) 
75 suffixes KiB, MiB, GiB, TiB, PiB and EiB (the "iB" is optional, e.g. "K" has the
76 same meaning as "KiB") or decimal (10^N) suffixes KB, MB, GB, PB and EB.
77 .TP
78 .BI \-c " cachefile"
79 Read from
80 .I cachefile
81 instead of reading from the default cache file
82 .IR /etc/blkid.tab .
83 If you want to start with a clean cache (i.e. don't report devices previously
84 scanned but not necessarily available at this time), specify
85 .IR /dev/null .
86 .TP
87 .B \-d
88 Don't encode non-printing characters. The non-printing characters are encoded
89 by ^ and M- notation by default. Note that \fB-o udev\fR output format uses
90 a diffrent encoding and this encoding cannot be disabled.
91 .TP
92 .B \-g
93 Perform a garbage collection pass on the blkid cache to remove
94 devices which no longer exist.
95 .TP
96 .B \-h
97 Display a usage message and exit.
98 .TP
99 .B \-i
100 Display I/O Limits (aka I/O topology) information.  The 'export' output format is
101 automatically enabled.  This option can be used together with the \fB-p\fR option.
102 .TP
103 .B \-l
104 Look up only one device that matches the search parameter specified with \fB-t\fR.
105 .TP
106 .B \-k
107 List all known filesystems and RAIDs and exit.
108 .TP
109 .B \-t
110 option.  If there are multiple devices that match the specified search
111 parameter, then the device with the highest priority is returned, and/or
112 the first device found at a given priority.  Device types in order of
113 decreasing priority are Device Mapper, EVMS, LVM, MD, and finally regular
114 block devices.  If this option is not specified,
115 .B blkid
116 will print all of the devices that match the search parameter.
117 .TP
118 .BI \-L " label"
119 Look up the device that uses this \fIlabel\fR (equal to: -l -o device -t
120 LABEL=<label>).  This lookup method is able to reliably use /dev/disk/by-label
121 udev symlinks (dependent on a setting in /etc/blkid.conf).  Avoid using the
122 symlinks directly; it is not reliable to use the symlinks without verification.
123 The \fB-L\fR option works on systems with and without udev.
124
125 Unfortunately, the original
126 .B blkid(8)
127 from e2fsprogs use the \fB-L\fR option as a
128 synonym for the \fB-o list\fR option.  For better portability, use \fB-l -o device
129 -t LABEL=<label>\fR and \fB-o list\fR in your scripts rather than the \fB-L\fR option.
130 .TP
131 .BI \-n " list "
132 Restrict the probing functions to the specified (comma-separated) \fIlist\fR of
133 superblock types (names).
134 The list items may be prefixed with "no" to specify the types which should be ignored.
135 For example:
136 .sp
137   blkid -p -n vfat,ext3,ext4 /dev/sda1
138 .sp
139 probes for vfat, ext3 and ext4 filesystems, and
140 .sp
141   blkid -p -n nominix /dev/sda1
142 .sp
143 probes for all supported formats except minix filesystems.
144 This option is only useful together with \fB-p\fR.
145 .TP
146 .BI \-o " format"
147 Display
148 .BR blkid 's
149 output using the specified format.  The
150 .I format
151 parameter may be:
152 .RS
153 .TP
154 .B full
155 print all tags (the default)
156 .TP
157 .B value
158 print the value of the tags
159 .TP
160 .B list
161 print the devices in a user-friendly format; this output format is unsupported
162 for low-level probing (\fB-p\fR or \fB-i\fR)
163 .TP
164 .B device
165 print the device name only; this output format is always enabled for \fB-L\fR
166 and \fB-U\fR options
167 .TP
168 .B udev
169 print key="value" pairs for easy import into the udev environment; the keys are
170 prefixed by ID_FS_ or ID_PART_ prefixes
171
172 The udev output returns the ID_FS_AMBIVALENT tag if more superblocks are detected,
173 and ID_PART_ENTRY_* tags are always returned for all partitions including empty
174 partitions.
175 .TP
176 .B export
177 print key=value pairs for easy import into the environment; this output format
178 is automatically enabled when I/O Limits (\fB-i\fR option) are requested
179 .RE
180 .TP
181 .BI \-O " offset"
182 Probe at the given \fIoffset\fR (only useful with \fB-p\fR).  This option can be
183 used together with the \fB-i\fR option.
184 .TP
185 .BI \-p
186 Switch to low-level superblock probing mode (bypass cache).
187
188 Note that low-level probing also returns information about partition table type
189 (PTTYPE tag) and partitions (PART_ENTRY_* tags).
190 .TP
191 .BI \-s " tag"
192 For each (specified) device, show only the tags that match
193 .IR tag .
194 It is possible to specify multiple
195 .B \-s
196 options.  If no tag is specified, then all tokens are shown for all
197 (specified) devices.
198 In order to just refresh the cache without showing any tokens, use
199 .B "-s none"
200 with no other options.
201 .TP
202 .BI \-S " size"
203 Overwrite device/file size (only useful with \fB-p\fR).
204 .TP
205 .BI \-t " NAME" = "value"
206 Search for block devices with tokens named
207 .I NAME
208 that have the value
209 .IR value ,
210 and display any devices which are found.
211 Common values for
212 .I NAME
213 include
214 .BR TYPE ,
215 .BR LABEL ,
216 and
217 .BR UUID .
218 If there are no devices specified on the command line, all block devices
219 will be searched; otherwise only the specified devices are searched.
220 .TP
221 .BI \-u " list "
222 Restrict the probing functions to the specified (comma-separated) \fIlist\fR of "usage" types.
223 Supported usage types are: filesystem, raid, crypto and other.  The list items may be
224 prefixed with "no" to specify the usage types which should be ignored.  For example:
225 .sp
226   blkid -p -u filesystem,other /dev/sda1
227 .sp
228 probes for all filesystem and other (e.g. swap) formats, and
229 .sp
230   blkid -p -u noraid /dev/sda1
231 .sp
232 probes for all supported formats except RAIDs.
233 This option is only useful together with \fB-p\fR.
234 .TP
235 .BI \-U " uuid "
236 Look up the device that uses this \fIuuid\fR.  For more details see the \fB-L\fR option.
237 .TP
238 .B \-v
239 Display version number and exit.
240 .TP
241 .BI \-w " writecachefile"
242 Write the device cache to
243 .I writecachefile
244 instead of writing it to the default cache file
245 .IR /etc/blkid.tab .
246 If you don't want to save the cache at all, specify
247 .IR /dev/null.
248 If not specified, it will be the same file as that given with the
249 .B \-c
250 option.
251 .TP
252 .I device
253 Display tokens from only the specified device.  It is possible to
254 give multiple
255 .I device
256 options on the command line.  If none is given, all devices which
257 appear in
258 .I /proc/partitions
259 are shown, if they are recognized.
260 .SH "RETURN CODE"
261 If the specified token was found, or if any tags were shown from (specified)
262 devices, 0 is returned.
263
264 If the specified token was not found, or no (specified) devices could be
265 identified, an exit code of 2 is returned.
266
267 For usage or other errors, an exit code of 4 is returned.
268
269 If the ambivalent low-level probing result was detected, an exit code of 8 is
270 returned.
271 .SH AUTHOR
272 .B blkid
273 was written by Andreas Dilger for libblkid and improved by Theodore Ts'o
274 and Karel Zak.
275 .SH AVAILABILITY
276 The blkid command is part of the util-linux package and is available from
277 ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
278 .SH "SEE ALSO"
279 .BR libblkid (3)
280 .BR findfs (8)
281 .BR wipefs (8)