Debian Codegraph @

libblkid/libblkid.3

raw
1 '\" t
2 .\" Title: libblkid
3 .\" Author: [see the "AUTHOR(S)" section]
4 .\" Generator: Asciidoctor 2.0.20
5 .\" Date: 2026-05-18
6 .\" Manual: Programmer's Manual
7 .\" Source: util-linux 2.42.1
8 .\" Language: English
9 .\"
10 .TH "LIBBLKID" "3" "2026-05-18" "util\-linux 2.42.1" "Programmer\*(Aqs Manual"
11 .ie \n(.g .ds Aq \(aq
12 .el .ds Aq '
13 .ss \n[.ss] 0
14 .nh
15 .ad l
16 .de URL
17 \fI\\$2\fP <\\$1>\\$3
18 ..
19 .als MTO URL
20 .if \n[.g] \{\
21 . mso www.tmac
22 . am URL
23 . ad l
24 . .
25 . am MTO
26 . ad l
27 . .
28 . LINKSTYLE blue R < >
29 .\}
30 .SH "NAME"
31 libblkid \- block device identification library
32 .SH "SYNOPSIS"
33 .sp
34 \fB#include <blkid.h>\fP
35 .sp
36 \fBcc\fP \fIfile.c\fP \fB\-lblkid\fP
37 .SH "DESCRIPTION"
38 .sp
39 The \fBlibblkid\fP library is used to identify block devices (disks) as to their content (e.g., filesystem type) as well as extracting additional information such as filesystem labels/volume names, unique identifiers/serial numbers. A common use is to allow use of \fBLABEL=\fP and \fBUUID=\fP tags instead of hard\-coding specific block device names into configuration files. See list of all available tags in \fBTAGS\fP section.
40 .sp
41 The low\-level part of the library also allows the extraction of information about partitions and block device topology.
42 .sp
43 The high\-level part of the library keeps information about block devices in a cache file and is verified to still be valid before being returned to the user (if the user has read permission on the raw block device, otherwise not). The cache file also allows unprivileged users (normally anyone other than root, or those not in the "disk" group) to locate devices by label/id. The standard location of the cache file can be overridden by the environment variable \fBBLKID_FILE\fP.
44 .sp
45 In situations where one is getting information about a single known device, it does not impact performance whether the cache is used or not (unless you are not able to read the block device directly).
46 .sp
47 The high\-level part of the library supports two methods to determine \fBLABEL/UUID\fP. It reads information directly from a block device or reads information from /dev/disk/by\-* udev symlinks. The udev is preferred method by default.
48 .sp
49 If you are dealing with multiple devices, use of the cache is highly recommended (even if empty) as devices will be scanned at most one time and the on\-disk cache will be updated if possible.
50 .sp
51 In some cases (modular kernels), block devices are not even visible until after they are accessed the first time, so it is critical that there is some way to locate these devices without enumerating only visible devices, so the use of the cache file is \fBrequired\fP in this situation.
52 .SH "CONFIGURATION FILE"
53 .sp
54 The standard location of the \fI/etc/blkid.conf\fP config file can be overridden by the environment variable \fBBLKID_CONF\fP. For more details about the config file see \fBblkid\fP(8) man page.
55 .SH "TAGS"
56 .sp
57 All available tags are listed below. Not all tags are supported for all file systems. To enable a tag, set one of the following flags with \fBblkid_probe_set_superblocks_flags\fP():
58 .sp
59 BLKID_SUBLKS_TYPE
60 .RS 4
61 .sp
62 .RS 4
63 .ie n \{\
64 \h'-04'\(bu\h'+03'\c
65 .\}
66 .el \{\
67 . sp -1
68 . IP \(bu 2.3
69 .\}
70 TYPE \- filesystem type
71 .RE
72 .RE
73 .sp
74 BLKID_SUBLKS_SECTYPE
75 .RS 4
76 .sp
77 .RS 4
78 .ie n \{\
79 \h'-04'\(bu\h'+03'\c
80 .\}
81 .el \{\
82 . sp -1
83 . IP \(bu 2.3
84 .\}
85 SEC_TYPE \- secondary filesystem type
86 .RE
87 .RE
88 .sp
89 BLKID_SUBLKS_LABEL
90 .RS 4
91 .sp
92 .RS 4
93 .ie n \{\
94 \h'-04'\(bu\h'+03'\c
95 .\}
96 .el \{\
97 . sp -1
98 . IP \(bu 2.3
99 .\}
100 LABEL \- filesystem label
101 .RE
102 .RE
103 .sp
104 BLKID_SUBLKS_LABELRAW
105 .RS 4
106 .sp
107 .RS 4
108 .ie n \{\
109 \h'-04'\(bu\h'+03'\c
110 .\}
111 .el \{\
112 . sp -1
113 . IP \(bu 2.3
114 .\}
115 LABEL_RAW \- raw label from FS superblock
116 .RE
117 .RE
118 .sp
119 BLKID_SUBLKS_UUID
120 .RS 4
121 .sp
122 .RS 4
123 .ie n \{\
124 \h'-04'\(bu\h'+03'\c
125 .\}
126 .el \{\
127 . sp -1
128 . IP \(bu 2.3
129 .\}
130 UUID \- filesystem UUID (lower case)
131 .RE
132 .sp
133 .RS 4
134 .ie n \{\
135 \h'-04'\(bu\h'+03'\c
136 .\}
137 .el \{\
138 . sp -1
139 . IP \(bu 2.3
140 .\}
141 UUID_SUB \- pool member UUID or device item UUID, etc. (e.g., zfs, btrfs, ...)
142 .RE
143 .sp
144 .RS 4
145 .ie n \{\
146 \h'-04'\(bu\h'+03'\c
147 .\}
148 .el \{\
149 . sp -1
150 . IP \(bu 2.3
151 .\}
152 LOGUUID \- external log UUID (e.g. xfs)
153 .RE
154 .RE
155 .sp
156 BLKID_SUBLKS_UUIDRAW
157 .RS 4
158 .sp
159 .RS 4
160 .ie n \{\
161 \h'-04'\(bu\h'+03'\c
162 .\}
163 .el \{\
164 . sp -1
165 . IP \(bu 2.3
166 .\}
167 UUID_RAW \- raw UUID from FS superblock
168 .RE
169 .RE
170 .sp
171 BLKID_SUBLKS_USAGE
172 .RS 4
173 .sp
174 .RS 4
175 .ie n \{\
176 \h'-04'\(bu\h'+03'\c
177 .\}
178 .el \{\
179 . sp -1
180 . IP \(bu 2.3
181 .\}
182 USAGE \- usage string: "raid", "filesystem", etc.
183 .RE
184 .RE
185 .sp
186 BLKID_SUBLKS_VERSION
187 .RS 4
188 .sp
189 .RS 4
190 .ie n \{\
191 \h'-04'\(bu\h'+03'\c
192 .\}
193 .el \{\
194 . sp -1
195 . IP \(bu 2.3
196 .\}
197 VERSION \- filesystem version
198 .RE
199 .RE
200 .sp
201 BLKID_SUBLKS_MAGIC
202 .RS 4
203 .sp
204 .RS 4
205 .ie n \{\
206 \h'-04'\(bu\h'+03'\c
207 .\}
208 .el \{\
209 . sp -1
210 . IP \(bu 2.3
211 .\}
212 SBMAGIC \- super block magic string
213 .RE
214 .sp
215 .RS 4
216 .ie n \{\
217 \h'-04'\(bu\h'+03'\c
218 .\}
219 .el \{\
220 . sp -1
221 . IP \(bu 2.3
222 .\}
223 SBMAGIC_OFFSET \- offset of SBMAGIC
224 .RE
225 .RE
226 .sp
227 BLKID_SUBLKS_FSINFO
228 .RS 4
229 .sp
230 .RS 4
231 .ie n \{\
232 \h'-04'\(bu\h'+03'\c
233 .\}
234 .el \{\
235 . sp -1
236 . IP \(bu 2.3
237 .\}
238 FSSIZE \- size of filesystem. Note that for XFS this will return the same value
239 as lsblk (without XFS\(cqs metadata), but for ext4 it will return the size with
240 metadata and for BTRFS will not count overhead of RAID configuration
241 (redundant data).
242 .RE
243 .sp
244 .RS 4
245 .ie n \{\
246 \h'-04'\(bu\h'+03'\c
247 .\}
248 .el \{\
249 . sp -1
250 . IP \(bu 2.3
251 .\}
252 FSLASTBLOCK \- last fsblock/total number of fsblocks
253 .RE
254 .sp
255 .RS 4
256 .ie n \{\
257 \h'-04'\(bu\h'+03'\c
258 .\}
259 .el \{\
260 . sp -1
261 . IP \(bu 2.3
262 .\}
263 FSBLOCKSIZE \- file system block size
264 .RE
265 .RE
266 .sp
267 The following tags are always enabled
268 .RS 4
269 .sp
270 .RS 4
271 .ie n \{\
272 \h'-04'\(bu\h'+03'\c
273 .\}
274 .el \{\
275 . sp -1
276 . IP \(bu 2.3
277 .\}
278 BLOCK_SIZE \- minimal block size accessible by file system
279 .RE
280 .sp
281 .RS 4
282 .ie n \{\
283 \h'-04'\(bu\h'+03'\c
284 .\}
285 .el \{\
286 . sp -1
287 . IP \(bu 2.3
288 .\}
289 MOUNT \- cluster mount name (ocfs only)
290 .RE
291 .sp
292 .RS 4
293 .ie n \{\
294 \h'-04'\(bu\h'+03'\c
295 .\}
296 .el \{\
297 . sp -1
298 . IP \(bu 2.3
299 .\}
300 EXT_JOURNAL \- external journal UUID
301 .RE
302 .sp
303 .RS 4
304 .ie n \{\
305 \h'-04'\(bu\h'+03'\c
306 .\}
307 .el \{\
308 . sp -1
309 . IP \(bu 2.3
310 .\}
311 SYSTEM_ID \- ISO9660 system identifier
312 .RE
313 .sp
314 .RS 4
315 .ie n \{\
316 \h'-04'\(bu\h'+03'\c
317 .\}
318 .el \{\
319 . sp -1
320 . IP \(bu 2.3
321 .\}
322 VOLUME_SET_ID \- ISO9660 volume set identifier
323 .RE
324 .sp
325 .RS 4
326 .ie n \{\
327 \h'-04'\(bu\h'+03'\c
328 .\}
329 .el \{\
330 . sp -1
331 . IP \(bu 2.3
332 .\}
333 DATA_PREPARER_ID \- ISO9660 data identifier
334 .RE
335 .sp
336 .RS 4
337 .ie n \{\
338 \h'-04'\(bu\h'+03'\c
339 .\}
340 .el \{\
341 . sp -1
342 . IP \(bu 2.3
343 .\}
344 PUBLISHER_ID \- ISO9660 publisher identifier
345 .RE
346 .sp
347 .RS 4
348 .ie n \{\
349 \h'-04'\(bu\h'+03'\c
350 .\}
351 .el \{\
352 . sp -1
353 . IP \(bu 2.3
354 .\}
355 APPLICATION_ID \- ISO9660 application identifier
356 .RE
357 .sp
358 .RS 4
359 .ie n \{\
360 \h'-04'\(bu\h'+03'\c
361 .\}
362 .el \{\
363 . sp -1
364 . IP \(bu 2.3
365 .\}
366 BOOT_SYSTEM_ID \- ISO9660 boot system identifier
367 .RE
368 .RE
369 .SH "AUTHORS"
370 .sp
371 \fBlibblkid\fP was written by Andreas Dilger for the ext2 filesystem utilities, with input from Ted Ts\(cqo. The library was subsequently heavily modified by Ted Ts\(cqo.
372 .sp
373 The low\-level probing code was rewritten by Karel Zak.
374 .SH "COPYING"
375 .sp
376 \fBlibblkid\fP is available under the terms of the GNU Library General Public License (LGPL), version 2 (or at your discretion any later version).
377 .SH "SEE ALSO"
378 .sp
379 \fBblkid\fP(8),
380 \fBfindfs\fP(8)
381 .SH "REPORTING BUGS"
382 .sp
383 For bug reports, use the \c
384 .URL "https://github.com/util\-linux/util\-linux/issues" "issue tracker" "."
385 .SH "AVAILABILITY"
386 .sp
387 The \fBlibblkid\fP library is part of the util\-linux package since version 2.15. It can be downloaded from \c
388 .URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."