1mlocate.db(5) File Formats Manual mlocate.db(5)
2
3
4
6 mlocate.db - a mlocate database
7
8
10 A mlocate database starts with a file header: 8 bytes for a magic num‐
11 ber ("\0mlocate" like a C literal), 4 bytes for the configuration block
12 size in big endian, 1 byte for file format version (0), 1 byte for the
13 “require visibility” flag (0 or 1), 2 bytes padding, and a NUL-termi‐
14 nated path name of the root of the database.
15
16 The header is followed by a configuration block, included to ensure
17 databases are not reused if some configuration changes could affect
18 their contents. The size of the configuration block in bytes is stored
19 in the file header. The configuration block is a sequence of variable
20 assignments, ordered by variable name. Each variable assignment con‐
21 sists of a NUL-terminated variable name and an ordered list of NUL-ter‐
22 minated values. The value list is terminated by one more NUL charac‐
23 ter. The ordering used is defined by the strcmp () function.
24
25 Currently defined variables are:
26
27 prune_bind_mounts
28 A single entry, the value of PRUNE_BIND_MOUNTS; one of the
29 strings 0 or 1.
30
31
32 prunefs
33 The value of PRUNEFS, each entry is converted to uppercase.
34
35
36 prunepaths
37 The value of PRUNEPATHS.
38
39
40 The rest of the file until EOF describes directories and their con‐
41 tents. Each directory starts with a header: 8 bytes for directory time
42 (seconds) in big endian, 4 bytes for directory time (nanoseconds) in
43 big endian (0 if unknown, less than 1,000,000,000), 4 bytes padding,
44 and a NUL-terminated path name of the the directory. Directory con‐
45 tents, a sequence of file entries sorted by name, follow.
46
47 Directory time is the maximum of st_ctime and st_mtime of the direc‐
48 tory. updatedb(8) uses the original data if the directory time in the
49 database and in the file system match exactly. Directory time equal to
50 0 always causes rescanning of the directory: this is necessary to han‐
51 dle directories which were being updated while building the database.
52
53 Each file entry starts with a single byte, marking its type:
54
55 0 A non-directory file. Followed by a NUL-terminated file (not
56 path) name.
57
58
59 1 A subdirectory. Followed by a NUL-terminated file (not path)
60 name.
61
62
63 2 Marks the end of the current directory.
64
65
66 locate(1) only reports file entries, directory names are not reported
67 because they are reported as an entry in their parent directory. The
68 only exception is the root directory of the database, which is stored
69 in the file header.
70
71
73 Miloslav Trmac <mitr@redhat.com>
74
75
77 locate(1), updatedb.conf(5), updatedb(8)
78
79
80
81mlocate Jan 2007 mlocate.db(5)