1BLKID(8) MAINTENANCE COMMANDS BLKID(8)
2
3
4
6 blkid - command-line utility to locate/print block device attributes
7
9 blkid -L label | -U uuid
10
11 blkid [-ghlv] [-c file] [-w file] [-o format]
12 [-s tag] [-t NAME=value] [device ...]
13
14 blkid -p [-O offset] [-S size] [-o format] [-s tag]
15 [-n list] [-u list] device [device ...]
16
17 blkid -i [-o format] [-s tag] device [device ...]
18
19
21 The blkid program is the command-line interface to working with lib‐
22 blkid(3) library. It can determine the type of content (e.g. filesys‐
23 tem, swap) a block device holds, and also attributes (tokens,
24 NAME=value pairs) from the content metadata (e.g. LABEL or UUID
25 fields).
26
27 blkid has two main forms of operation: either searching for a device
28 with a specific NAME=value pair, or displaying NAME=value pairs for one
29 or more devices.
30
32 The size and offset arguments may be followed by binary (2^N) suffixes
33 KiB, MiB, GiB, TiB, PiB and EiB (the "iB" is optional, e.g. "K" has the
34 same meaning as "KiB") or decimal (10^N) suffixes KB, MB, GB, PB and
35 EB.
36
37 -c cachefile
38 Read from cachefile instead of reading from the default cache
39 file /etc/blkid/blkid.tab. If you want to start with a clean
40 cache (i.e. don't report devices previously scanned but not nec‐
41 essarily available at this time), specify /dev/null.
42
43 -g Perform a garbage collection pass on the blkid cache to remove
44 devices which no longer exist.
45
46 -h Display a usage message and exit.
47
48 -i Display I/O Limits (aka I/O topology) information. The 'export'
49 output format is automatically enabled. This option could be
50 used together with -p option.
51
52 -l Look up one device that matches the search parameter specified
53 using the -t option. If there are multiple devices that match
54 the specified search parameter, then the device with the highest
55 priority is returned, and/or the first device found at a given
56 priority. Device types in order of decreasing priority are
57 Device Mapper, EVMS, LVM, MD, and finally regular block devices.
58 If this option is not specified, blkid will print all of the
59 devices that match the search parameter.
60
61 -L label
62 Look up one device that uses the label (same as: -l -o device -t
63 LABEL=<label>). This look up method is able to reliable use
64 /dev/disk/by-label udev symlinks (depends on setting in
65 /etc/blkid.conf). Avoid to use the symlinks directly. It is not
66 reliable to use the symlinks without verification. The -L
67 option works on systems with and without udev.
68
69 Unfortunately, the original blkid(8) from e2fsprogs use the -L
70 option as a synonym to the -o list option. For better portabil‐
71 ity use "-l -o device -t LABEL=<label>" and "-o list" in your
72 scripts rather than -L option.
73
74 -n list
75 Restrict probing functions to defined (comma separated) list of
76 superblock types (names). The list can be prefixed with "no" to
77 specify the types which should be ignored. For example:
78
79 blkid -p -n vfat,ext3,ext4 /dev/sda1
80
81 probes for vfat, ext3 and ext4 filesystems, and
82
83 blkid -p -u nominix /dev/sda1
84
85 probes for all supported formats exclude minix filesystem. This
86 option is useful with -p only.
87
88 -o format
89 Display blkid's output using the specified format. The format
90 parameter may be:
91
92 full print all tags (the default)
93
94 value print the value of the tags
95
96 list print the devices in a user-friendly format, this output
97 format is unsupported for low-level probing (-p or -i)
98
99 device print the device name only, this output format is always
100 enabled for -L and -U options
101
102 udev print key="value" pairs for easy import into the udev
103 environment
104
105 export print key=value pairs for easy import into the environ‐
106 ment. This output format is automatically enabled when
107 I/O Limits (-i option) are requested.
108
109 -O offset
110 Probe at the given offset (only useful with -p). This option
111 could be used together with -i option.
112
113 -p Switch to low-level superblock probing mode (bypass cache).
114
115 -s tag For each (specified) device, show only the tags that match tag.
116 It is possible to specify multiple -s options. If no tag is
117 specified, then all tokens are shown for all (specified)
118 devices. In order to just refresh the cache without showing any
119 tokens, use -s none with no other options.
120
121 -S size
122 Overwrite device/file size (only useful with -p).
123
124 -t NAME=value
125 Search for block devices with tokens named NAME that have the
126 value value, and display any devices which are found. Common
127 values for NAME include TYPE, LABEL, and UUID. If there are no
128 devices specified on the command line, all block devices will be
129 searched; otherwise only the specified devices are searched.
130
131 -u list
132 Restrict probing functions to defined (comma separated) list of
133 "usage" types. Supported usage types are: filesystem, raid,
134 crypto and other. The list can be prefixed with "no" to specify
135 the usage types which should be ignored. For example:
136
137 blkid -p -u filesystem,other /dev/sda1
138
139 probes for all filesystems and others (e.g. swap) formats, and
140
141 blkid -p -u noraid /dev/sda1
142
143 probes for all supported formats exclude RAIDs. This option is
144 useful with -p only.
145
146 -U uuid
147 Look up one device that uses the uuid. For more details see the
148 -L option.
149
150 -v Display version number and exit.
151
152 -w writecachefile
153 Write the device cache to writecachefile instead of writing it
154 to the default cache file /etc/blkid/blkid.tab. If you don't
155 want to save the cache to the default file, specify /dev/null.
156 If not specified it will be the same file as that given by the
157 -c option.
158
159 device Display tokens from only the specified device. It is possible
160 to give multiple device options on the command line. If none is
161 given, all devices which appear in /proc/partitions are shown,
162 if they are recognized.
163
165 If the specified token was found, or if any tags were shown from (spec‐
166 ified) devices, 0 is returned. If the specified token was not found,
167 or no (specified) devices could be identified, an exit code of 2 is
168 returned. For usage or other errors, an exit code of 4 is returned.
169
171 blkid was written by Andreas Dilger for libblkid and improved by
172 Theodore Ts'o and Karel Zak.
173
175 The blkid command is part of the util-linux-ng package and is available
176 from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
177
179 libblkid(3) findfs(8) wipefs(8)
180
181
182
183Linux February 2009 BLKID(8)