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