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