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