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.
27
28 In situations where one is getting information about a single known
29 device, it does not impact performance whether the cache is used or not
30 (unless you are not able to read the block device directly). If you
31 are dealing with multiple devices use of the cache is highly recom‐
32 mended (even if empty) as devices will be scanned at most one time, and
33 the on-disk cache will be updated if possible. There is rarely a rea‐
34 son not to use the cache.
35
36 In some cases (modular kernels), block devices are not even visible
37 until after they are accessed the first time, so it is critical that
38 there is some way to locate these devices without enumerating only vis‐
39 ible devices, so the use of the cache file is required in this situa‐
40 tion.
41
43 libblkid was written by Andreas Dilger for the ext2 filesystem util‐
44 ties, with input from Ted Ts'o. The library was subsequently heavily
45 modified by Ted Ts'o.
46
48 /etc/blkid/blkid.tab
49 Caches data extracted from each recognized block device.
50
52 libblkid is part of the e2fsprogs package since version 1.33 and is
53 available from http://e2fsprogs.sourceforge.net.
54
56 libblkid is available under the terms of the GNU Library General Public
57 License (LGPL), version 2 (or at your discretion any later version). A
58 copy of the LGPL should be included with this library in the file COPY‐
59 ING. If not, write to
60 Free Software Foundation, Inc.
61 59 Temple Place
62 Suite 330
63 Boston, MA 02111-1307 USA
64
65 or visit http://www.gnu.org/licenses/licenses.html#LGPL
66 ⟨http://www.gnu.org/licenses/licenses.html#LGPL⟩
67
69 blkid_get_cache(3), blkid_put_cache(3), blkid_get_dev(3),
70 blkid_probe_all(3), blkid_get_devname(3), blkid_get_tag_value(3),
71 blkid.tab(7)
72
73
74
75E2fsprogs version 1.40.2 July 2007 LIBBLKID(3)