1LIBBLKID(3)                   Programmers Manual                   LIBBLKID(3)
2
3
4

NAME

6       libblkid - block device identification library
7

SYNOPSIS

9       #include <blkid.h>
10
11       cc file.c -lblkid
12

DESCRIPTION

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. See list of all available tags in TAGS section.
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 reads
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

CONFIGURATION FILE

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

TAGS

57       All available tags are listed below. Not all tags are supported for all
58       file systems. To enable a tag, set one of the following flags with
59       blkid_probe_set_superblocks_flags():
60
61       BLKID_SUBLKS_TYPE
62
63           •   TYPE - filesystem type
64
65       BLKID_SUBLKS_SECTYPE
66
67           •   SEC_TYPE - secondary filesystem type
68
69       BLKID_SUBLKS_LABEL
70
71           •   LABEL - filesystem label
72
73       BLKID_SUBLKS_LABELRAW
74
75           •   LABEL_RAW - raw label from FS superblock
76
77       BLKID_SUBLKS_UUID
78
79           •   UUID - filesystem UUID (lower case)
80
81           •   UUID_SUB - subvolume uuid (e.g. btrfs)
82
83           •   LOGUUID - external log UUID (e.g. xfs)
84
85       BLKID_SUBLKS_UUIDRAW
86
87           •   UUID_RAW - raw UUID from FS superblock
88
89       BLKID_SUBLKS_USAGE
90
91           •   USAGE - usage string: "raid", "filesystem", etc.
92
93       BLKID_SUBLKS_VERSION
94
95           •   VERSION - filesystem version
96
97       BLKID_SUBLKS_MAGIC
98
99           •   SBMAGIC - super block magic string
100
101           •   SBMAGIC_OFFSET - offset of SBMAGIC
102
103       BLKID_SUBLKS_FSINFO
104
105           •   FSSIZE - size of filesystem. Note that for XFS this will return
106               the same value as lsblk (without XFS’s metadata), but for ext4
107               it will return the size with metadata and for BTRFS will not
108               count overhead of RAID configuration (redundant data).
109
110           •   FSLASTBLOCK - last fsblock/total number of fsblocks
111
112           •   FSBLOCKSIZE - file system block size
113
114       The following tags are always enabled
115
116           •   BLOCK_SIZE - minimal block size accessible by file system
117
118           •   MOUNT - cluster mount name (ocfs only)
119
120           •   EXT_JOURNAL - external journal UUID
121
122           •   SYSTEM_ID - ISO9660 system identifier
123
124           •   VOLUME_SET_ID - ISO9660 volume set identifier
125
126           •   DATA_PREPARER_ID - ISO9660 data identifier
127
128           •   PUBLISHER_ID - ISO9660 publisher identifier
129
130           •   APPLICATION_ID - ISO9660 application identifier
131
132           •   BOOT_SYSTEM_ID - ISO9660 boot system identifier
133

AUTHORS

135       libblkid was written by Andreas Dilger for the ext2 filesystem
136       utilities, with input from Ted Ts’o. The library was subsequently
137       heavily modified by Ted Ts’o.
138
139       The low-level probing code was rewritten by Karel Zak.
140

COPYING

142       libblkid is available under the terms of the GNU Library General Public
143       License (LGPL), version 2 (or at your discretion any later version).
144

SEE ALSO

146       blkid(8), findfs(8)
147

REPORTING BUGS

149       For bug reports, use the issue tracker at
150       https://github.com/util-linux/util-linux/issues.
151

AVAILABILITY

153       The libblkid library is part of the util-linux package since version
154       2.15. It can be downloaded from Linux Kernel Archive
155       <https://www.kernel.org/pub/linux/utils/util-linux/>.
156
157
158
159util-linux 2.39.2                 2023-06-14                       LIBBLKID(3)
Impressum