1BLKID(8) System Administration BLKID(8)
2
3
4
6 blkid - locate/print block device attributes
7
9 blkid --label label | --uuid uuid
10
11
12 blkid [--no-encoding --garbage-collect --list-one --cache-file file]
13 [--output format] [--match-tag tag] [--match-token NAME=value]
14 [device ...]
15
16
17 blkid --probe [--offset offset] [--output format] [--size size]
18 [--match-tag tag] [--match-types list] [--usages list]
19 [--no-part-details] device ...
20
21
22 blkid --info [--output format] [--match-tag tag] device ...
23
24
26 The blkid program is the command-line interface to working with the
27 libblkid(3) library. It can determine the type of content (e.g.
28 filesystem or swap) that a block device holds, and also the attributes
29 (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or
30 UUID fields).
31
32 It is recommended to use lsblk(8) command to get information about
33 block devices, or lsblk --fs to get an overview of filesystems, or
34 findmnt(8) to search in already mounted filesystems.
35
36 lsblk(8) provides more information, better control on output
37 formatting, easy to use in scripts and it does not require root
38 permissions to get actual information. blkid reads information
39 directly from devices and for non-root users it returns cached
40 unverified information. blkid is mostly designed for system
41 services and to test libblkid functionality.
42
43
44 When device is specified, tokens from only this device are displayed.
45 It is possible to specify multiple device arguments on the command
46 line. If none is given, all partitions or unpartitioned devices which
47 appear in /proc/partitions are shown, if they are recognized.
48
49 blkid has two main forms of operation: either searching for a device
50 with a specific NAME=value pair, or displaying NAME=value pairs for one
51 or more specified devices.
52
53 For security reasons blkid silently ignores all devices where the prob‐
54 ing result is ambivalent (multiple colliding filesystems are detected).
55 The low-level probing mode (-p) provides more information and extra
56 return code in this case. It's recommended to use wipefs(8) to get a
57 detailed overview and to erase obsolete stuff (magic strings) from the
58 device.
59
60
62 The size and offset arguments may be followed by the multiplicative
63 suffixes like KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB,
64 PiB, EiB, ZiB and YiB (the "iB" is optional, e.g. "K" has the same
65 meaning as "KiB"), or the suffixes KB (=1000), MB (=1000*1000), and so
66 on for GB, TB, PB, EB, ZB and YB.
67
68 -c, --cache-file cachefile
69 Read from cachefile instead of reading from the default cache
70 file (see the CONFIGURATION FILE section for more details). If
71 you want to start with a clean cache (i.e. don't report devices
72 previously scanned but not necessarily available at this time),
73 specify /dev/null.
74
75 -d, --no-encoding
76 Don't encode non-printing characters. The non-printing charac‐
77 ters are encoded by ^ and M- notation by default. Note that the
78 --output udev output format uses a different encoding which can‐
79 not be disabled.
80
81 -D, --no-part-details
82 Don't print information (PART_ENTRY_* tags) from partition table
83 in low-level probing mode.
84
85 -g, --garbage-collect
86 Perform a garbage collection pass on the blkid cache to remove
87 devices which no longer exist.
88
89 -h, --help
90 Display a usage message and exit.
91
92 -i, --info
93 Display information about I/O Limits (aka I/O topology). The
94 'export' output format is automatically enabled. This option
95 can be used together with the --probe option.
96
97 -k, --list-filesystems
98 List all known filesystems and RAIDs and exit.
99
100 -l, --list-one
101 Look up only one device that matches the search parameter speci‐
102 fied with the --match-token option. If there are multiple
103 devices that match the specified search parameter, then the
104 device with the highest priority is returned, and/or the first
105 device found at a given priority. Device types in order of
106 decreasing priority are: Device Mapper, EVMS, LVM, MD, and
107 finally regular block devices. If this option is not specified,
108 blkid will print all of the devices that match the search param‐
109 eter.
110
111 -L, --label label
112 Look up the device that uses this filesystem label; this is
113 equal to --list-one --output device --match-token LABEL=label.
114 This lookup method is able to reliably use /dev/disk/by-label
115 udev symlinks (dependent on a setting in /etc/blkid.conf).
116 Avoid using the symlinks directly; it is not reliable to use the
117 symlinks without verification. The --label option works on sys‐
118 tems with and without udev.
119
120 Unfortunately, the original blkid(8) from e2fsprogs uses the -L
121 option as a synonym for -o list. For better portability, use -l
122 -o device -t LABEL=label and -o list in your scripts rather than
123 the -L option.
124
125 -n, --match-types list
126 Restrict the probing functions to the specified (comma-sepa‐
127 rated) list of superblock types (names). The list items may be
128 prefixed with "no" to specify the types which should be ignored.
129 For example:
130
131 blkid --probe --match-types vfat,ext3,ext4 /dev/sda1
132
133 probes for vfat, ext3 and ext4 filesystems, and
134
135 blkid --probe --match-types nominix /dev/sda1
136
137 probes for all supported formats except minix filesystems. This
138 option is only useful together with --probe.
139
140 -o, --output format
141 Use the specified output format. Note that the order of vari‐
142 ables and devices is not fixed. See also option -s. The format
143 parameter may be:
144
145 full print all tags (the default)
146
147 value print the value of the tags
148
149 list print the devices in a user-friendly format; this output
150 format is unsupported for low-level probing (--probe or
151 --info).
152
153 This output format is DEPRECATED in favour of the
154 lsblk(8) command.
155
156 device print the device name only; this output format is always
157 enabled for the --label and --uuid options
158
159 udev print key="value" pairs for easy import into the udev
160 environment; the keys are prefixed by ID_FS_ or ID_PART_
161 prefixes. The value may be modified to be safe for udev
162 environment; allowed is plain ASCII, hex-escaping and
163 valid UTF-8, everything else (including whitespaces) is
164 replaced with '_'. The keys with _ENC postfix use hex-
165 escaping for unsafe chars.
166
167 The udev output returns the ID_FS_AMBIVALENT tag if more
168 superblocks are detected, and ID_PART_ENTRY_* tags are
169 always returned for all partitions including empty parti‐
170 tions.
171
172 This output format is DEPRECATED.
173
174 export print key=value pairs for easy import into the environ‐
175 ment; this output format is automatically enabled when
176 I/O Limits (--info option) are requested.
177
178 The non-printing characters are encoded by ^ and M- nota‐
179 tion and all potentially unsafe characters are escaped.
180
181 -O, --offset offset
182 Probe at the given offset (only useful with --probe). This
183 option can be used together with the --info option.
184
185 -p, --probe
186 Switch to low-level superblock probing mode (bypassing the
187 cache).
188
189 Note that low-level probing also returns information about par‐
190 tition table type (PTTYPE tag) and partitions (PART_ENTRY_*
191 tags). The tag names produced by low-level probing are based on
192 names used internally by libblkid and it may be different than
193 when executed without --probe (for example PART_ENTRY_UUID= vs
194 PARTUUID=). See also --no-part-details.
195
196 -s, --match-tag tag
197 For each (specified) device, show only the tags that match tag.
198 It is possible to specify multiple --match-tag options. If no
199 tag is specified, then all tokens are shown for all (specified)
200 devices. In order to just refresh the cache without showing any
201 tokens, use --match-tag none with no other options.
202
203 -S, --size size
204 Override the size of device/file (only useful with --probe).
205
206 -t, --match-token NAME=value
207 Search for block devices with tokens named NAME that have the
208 value value, and display any devices which are found. Common
209 values for NAME include TYPE, LABEL, and UUID. If there are no
210 devices specified on the command line, all block devices will be
211 searched; otherwise only the specified devices are searched.
212
213 -u, --usages list
214 Restrict the probing functions to the specified (comma-sepa‐
215 rated) list of "usage" types. Supported usage types are:
216 filesystem, raid, crypto and other. The list items may be pre‐
217 fixed with "no" to specify the usage types which should be
218 ignored. For example:
219
220 blkid --probe --usages filesystem,other /dev/sda1
221
222 probes for all filesystem and other (e.g. swap) formats, and
223
224 blkid --probe --usages noraid /dev/sda1
225
226 probes for all supported formats except RAIDs. This option is
227 only useful together with --probe.
228
229 -U, --uuid uuid
230 Look up the device that uses this filesystem uuid. For more
231 details see the --label option.
232
233 -V, --version
234 Display version number and exit.
235
237 If the specified device or device addressed by specified token (option
238 --match-token) was found and it's possible to gather any information
239 about the device, an exit code 0 is returned. Note the option
240 --match-tag filters output tags, but it does not affect return code.
241
242 If the specified token was not found, or no (specified) devices could
243 be identified, or it is impossible to gather any information about the
244 device identifiers or device content an exit code of 2 is returned.
245
246 For usage or other errors, an exit code of 4 is returned.
247
248 If an ambivalent probing result was detected by low-level probing mode
249 (-p), an exit code of 8 is returned.
250
252 The standard location of the /etc/blkid.conf config file can be over‐
253 ridden by the environment variable BLKID_CONF. The following options
254 control the libblkid library:
255
256 SEND_UEVENT=<yes|not>
257 Sends uevent when /dev/disk/by-{label,uuid,partuuid,partlabel}/
258 symlink does not match with LABEL, UUID, PARTUUID or PARTLABEL
259 on the device. Default is "yes".
260
261 CACHE_FILE=<path>
262 Overrides the standard location of the cache file. This setting
263 can be overridden by the environment variable BLKID_FILE.
264 Default is /run/blkid/blkid.tab, or /etc/blkid.tab on systems
265 without a /run directory.
266
267 EVALUATE=<methods>
268 Defines LABEL and UUID evaluation method(s). Currently, the
269 libblkid library supports the "udev" and "scan" methods. More
270 than one method may be specified in a comma-separated list.
271 Default is "udev,scan". The "udev" method uses udev
272 /dev/disk/by-* symlinks and the "scan" method scans all block
273 devices from the /proc/partitions file.
274
276 blkid was written by Andreas Dilger for libblkid and improved by
277 Theodore Ts'o and Karel Zak.
278
280 Setting LIBBLKID_DEBUG=all enables debug output.
281
283 libblkid(3), findfs(8), lsblk(8), wipefs(8)
284
286 The blkid command is part of the util-linux package and is available
287 from https://www.kernel.org/pub/linux/utils/util-linux/.
288
289
290
291util-linux March 2013 BLKID(8)