1LIBBLKID(3) Library Functions Manual LIBBLKID(3)
2
3
4
6 libblkid - block device identification library
7
9 #include <blkid/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 identi‐
17 fiers/serial numbers, etc. A common use is to allow use of LABEL= and
18 UUID= tags instead of hard-coding specific block device names into con‐
19 figuration files.
20
21 Block device information is normally kept in a cache file
22 /etc/blkid/blkid.tab and is verified to still be valid before being
23 returned to the user (if the user has read permission on the raw block
24 device, otherwise not). The cache file also allows unprivileged users
25 (normally anyone other than root, or those not in the "disk" group) to
26 locate devices by label/id. The standard location of the cache file
27 can be overridden by the environment variable BLKID_FILE.
28
29 In situations where one is getting information about a single known
30 device, it does not impact performance whether the cache is used or not
31 (unless you are not able to read the block device directly). If you
32 are dealing with multiple devices, use of the cache is highly recom‐
33 mended (even if empty) as devices will be scanned at most one time and
34 the on-disk cache will be updated if possible. There is rarely a rea‐
35 son not to use the cache.
36
37 In some cases (modular kernels), block devices are not even visible
38 until after they are accessed the first time, so it is critical that
39 there is some way to locate these devices without enumerating only vis‐
40 ible devices, so the use of the cache file is required in this situa‐
41 tion.
42
44 The standard location of the /etc/blkid.conf config file can be over‐
45 ridden by the environment variable BLKID_CONF. The following options
46 control the libblkid library:
47
48 SEND_UEVENT=<yes|not>
49 Sends uevent when /dev/disk/by-{label,uuid}/ symlink does not
50 match with LABEL or UUID on the device. Default is "yes".
51
52 CACHE_FILE=<path>
53 Overrides the standard location of the cache file. This setting
54 can be overridden by the environment variable BLKID_FILE.
55 Default is /etc/blkid/blkid.tab.
56
57 EVALUATE=<methods>
58 Defines LABEL and UUID evaluation method(s). Currently, the lib‐
59 blkid library supports "udev" and "scan" methods. More than one
60 methods may be specified in a comma separated list. Default is
61 "udev,scan". The "udev" method uses udev /dev/disk/by-* symlinks
62 and the "scan" method scans all block devices from the
63 /proc/partitions file.
64
66 libblkid was written by Andreas Dilger for the ext2 filesystem util‐
67 ties, with input from Ted Ts'o. The library was subsequently heavily
68 modified by Ted Ts'o.
69
70 The low-level probing code was rewritten by Karel Zak.
71
73 /etc/blkid/blkid.tab
74 caches data extracted from each recognized block
75 device
76
77 /etc/blkid.conf configuration file
78
80 libblkid is part of the util-linux-ng package since version 2.15 and is
81 available from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
82
84 libblkid is available under the terms of the GNU Library General Public
85 License (LGPL), version 2 (or at your discretion any later version). A
86 copy of the LGPL should be included with this library in the file COPY‐
87 ING. If not, write to
88 Free Software Foundation, Inc.
89 51 Franklin St
90 Fifth Floor
91 Boston, MA 02110-1301 USA
92
93 or visit http://www.gnu.org/licenses/licenses.html#LGPL
94 ⟨http://www.gnu.org/licenses/licenses.html#LGPL⟩
95
97 blkid(8) findfs(8)
98
99
100
101util-linux-ng May 2009 LIBBLKID(3)