1LIBBLKID(3) Programmer's Manual LIBBLKID(3)
2
3
4
6 libblkid - block device identification library
7
9 #include <blkid.h>
10
11 cc file.c -lblkid
12
14 The libblkid library is used to identify block devices (disks) as to
15 their content (e.g., filesystem type) as well as extracting additional
16 information such as filesystem labels/volume names, unique
17 identifiers/serial numbers. A common use is to allow use of LABEL= and
18 UUID= tags instead of hard-coding specific block device names into
19 configuration files.
20
21 The low-level part of the library also allows the extraction of
22 information about partitions and block device topology.
23
24 The high-level part of the library keeps information about block
25 devices in a cache file and is verified to still be valid before being
26 returned to the user (if the user has read permission on the raw block
27 device, otherwise not). The cache file also allows unprivileged users
28 (normally anyone other than root, or those not in the "disk" group) to
29 locate devices by label/id. The standard location of the cache file can
30 be overridden by the environment variable BLKID_FILE.
31
32 In situations where one is getting information about a single known
33 device, it does not impact performance whether the cache is used or not
34 (unless you are not able to read the block device directly).
35
36 The high-level part of the library supports two methods to determine
37 LABEL/UUID. It reads information directly from a block device or read
38 information from /dev/disk/by-* udev symlinks. The udev is preferred
39 method by default.
40
41 If you are dealing with multiple devices, use of the cache is highly
42 recommended (even if empty) as devices will be scanned at most one time
43 and the on-disk cache will be updated if possible.
44
45 In some cases (modular kernels), block devices are not even visible
46 until after they are accessed the first time, so it is critical that
47 there is some way to locate these devices without enumerating only
48 visible devices, so the use of the cache file is required in this
49 situation.
50
52 The standard location of the /etc/blkid.conf config file can be
53 overridden by the environment variable BLKID_CONF. For more details
54 about the config file see blkid(8) man page.
55
57 libblkid was written by Andreas Dilger for the ext2 filesystem
58 utilities, with input from Ted Ts’o. The library was subsequently
59 heavily modified by Ted Ts’o.
60
61 The low-level probing code was rewritten by Karel Zak.
62
64 libblkid is available under the terms of the GNU Library General Public
65 License (LGPL), version 2 (or at your discretion any later version).
66
68 blkid(8), findfs(8)
69
71 For bug reports, use the issue tracker at
72 https://github.com/util-linux/util-linux/issues.
73
75 The libblkid library is part of the util-linux package since version
76 2.15. It can be downloaded from Linux Kernel Archive
77 <https://www.kernel.org/pub/linux/utils/util-linux/>.
78
79
80
81util-linux 2.38.1 2022-08-04 LIBBLKID(3)