1MTREE(5) BSD File Formats Manual MTREE(5)
2
4 mtree — format of mtree dir hierarchy files
5
7 The mtree format is a textual format that describes a collection of
8 filesystem objects. Such files are typically used to create or verify
9 directory hierarchies.
10
11 General Format
12 An mtree file consists of a series of lines, each providing information
13 about a single filesystem object. Leading whitespace is always ignored.
14
15 When encoding file or pathnames, any backslash character or character
16 outside of the 95 printable ASCII characters must be encoded as a a back‐
17 slash followed by three octal digits. When reading mtree files, any
18 appearance of a backslash followed by three octal digits should be con‐
19 verted into the corresponding character.
20
21 Each line is interpreted independently as one of the following types:
22
23 Signature The first line of any mtree file must begin with “#mtree”.
24 If a file contains any full path entries, the first line
25 should begin with “#mtree v2.0”, otherwise, the first line
26 should begin with “#mtree v1.0”.
27
28 Blank Blank lines are ignored.
29
30 Comment Lines beginning with # are ignored.
31
32 Special Lines beginning with / are special commands that influence
33 the interpretation of later lines.
34
35 Relative If the first whitespace-delimited word has no / characters,
36 it is the name of a file in the current directory. Any rela‐
37 tive entry that describes a directory changes the current
38 directory.
39
40 dot-dot As a special case, a relative entry with the filename ..
41 changes the current directory to the parent directory.
42 Options on dot-dot entries are always ignored.
43
44 Full If the first whitespace-delimited word has a / character
45 after the first character, it is the pathname of a file rela‐
46 tive to the starting directory. There can be multiple full
47 entries describing the same file.
48
49 Some tools that process mtree files may require that multiple lines
50 describing the same file occur consecutively. It is not permitted for
51 the same file to be mentioned using both a relative and a full file spec‐
52 ification.
53
54 Special commands
55 Two special commands are currently defined:
56
57 /set This command defines default values for one or more keywords.
58 It is followed on the same line by one or more whitespace-
59 separated keyword definitions. These definitions apply to
60 all following files that do not specify a value for that key‐
61 word.
62
63 /unset This command removes any default value set by a previous /set
64 command. It is followed on the same line by one or more key‐
65 words separated by whitespace.
66
67 Keywords
68 After the filename, a full or relative entry consists of zero or more
69 whitespace-separated keyword definitions. Each such definition consists
70 of a key from the following list immediately followed by an '=' sign and
71 a value. Software programs reading mtree files should warn about unrec‐
72 ognized keywords.
73
74 Currently supported keywords are as follows:
75
76 cksum The checksum of the file using the default algorithm speci‐
77 fied by the cksum(1) utility.
78
79 contents The full pathname of a file that holds the contents of this
80 file.
81
82 flags The file flags as a symbolic name. See chflags(1) for infor‐
83 mation on these names. If no flags are to be set the string
84 “none” may be used to override the current default.
85
86 gid The file group as a numeric value.
87
88 gname The file group as a symbolic name.
89
90 ignore Ignore any file hierarchy below this file.
91
92 link The target of the symbolic link when type=link.
93
94 md5 The MD5 message digest of the file.
95
96 md5digest A synonym for md5.
97
98 mode The current file's permissions as a numeric (octal) or sym‐
99 bolic value.
100
101 nlink The number of hard links the file is expected to have.
102
103 nochange Make sure this file or directory exists but otherwise ignore
104 all attributes.
105
106 ripemd160digest
107 The RIPEMD160 message digest of the file.
108
109 rmd160 A synonym for ripemd160digest.
110
111 rmd160digest
112 A synonym for ripemd160digest.
113
114 sha1 The FIPS 160-1 (“SHA-1”) message digest of the file.
115
116 sha1digest A synonym for sha1.
117
118 sha256 The FIPS 180-2 (“SHA-256”) message digest of the file.
119
120 sha256digest
121 A synonym for sha256.
122
123 size The size, in bytes, of the file.
124
125 time The last modification time of the file.
126
127 type The type of the file; may be set to any one of the following:
128
129 block block special device
130 char character special device
131 dir directory
132 fifo fifo
133 file regular file
134 link symbolic link
135 socket socket
136
137 uid The file owner as a numeric value.
138
139 uname The file owner as a symbolic name.
140
142 cksum(1), find(1), mtree(8)
143
145 The FreeBSD implementation of mtree does not currently support the mtree
146 2.0 format. The requirement for a “#mtree” signature line is new and not
147 yet widely implemented.
148
150 The mtree utility appeared in 4.3BSD-Reno. The MD5 digest capability was
151 added in FreeBSD 2.1, in response to the widespread use of programs which
152 can spoof cksum(1). The SHA-1 and RIPEMD160 digests were added in
153 FreeBSD 4.0, as new attacks have demonstrated weaknesses in MD5. The
154 SHA-256 digest was added in FreeBSD 6.0. Support for file flags was
155 added in FreeBSD 4.0, and mostly comes from NetBSD. The “full” entry
156 format was added by NetBSD.
157
158BSD May 6, 2008 BSD