Whamcloud - gitweb
debian: add support for DEB_BUILD_OPTIONS=parallel=N
[tools/e2fsprogs.git] / misc / chattr.1.in
1 .\" -*- nroff -*-
2 .TH CHATTR 1 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
3 .SH NAME
4 chattr \- change file attributes on a Linux file system
5 .SH SYNOPSIS
6 .B chattr
7 [
8 .B \-RVf
9 ]
10 [
11 .B \-v
12 .I version
13 ]
14 [
15 .B \-p
16 .I project
17 ]
18 [
19 .I mode
20 ]
21 .I files...
22 .SH DESCRIPTION
23 .B chattr
24 changes the file attributes on a Linux file system.
25 .PP
26 The format of a symbolic
27 .I mode
28 is
29 .BR +-= [ aAcCdDeFijmPsStTux ].
30 .PP
31 The operator
32 .RB ' + '
33 causes the selected attributes to be added to the
34 existing attributes of the files;
35 .RB ' - '
36 causes them to be removed; and
37 .RB ' = '
38 causes them to be the only attributes that the files have.
39 .PP
40 The letters
41 .RB ' aAcCdDeFijmPsStTux '
42 select the new attributes for the files:
43 append only
44 .RB ( a ),
45 no atime updates
46 .RB ( A ),
47 compressed
48 .RB ( c ),
49 no copy on write
50 .RB ( C ),
51 no dump
52 .RB ( d ),
53 synchronous directory updates
54 .RB ( D ),
55 extent format
56 .RB ( e ),
57 case-insensitive directory lookups
58 .RB ( F ),
59 immutable
60 .RB ( i ),
61 data journaling
62 .RB ( j ),
63 don't compress
64 .RB ( m ),
65 project hierarchy
66 .RB ( P ),
67 secure deletion
68 .RB ( s ),
69 synchronous updates
70 .RB ( S ),
71 no tail-merging
72 .RB ( t ),
73 top of directory hierarchy
74 .RB ( T ),
75 undeletable
76 .RB ( u ),
77 and direct access for files
78 .RB ( x ).
79 .PP
80 The following attributes are read-only, and may be listed by
81 .BR lsattr (1)
82 but not modified by chattr:
83 encrypted
84 .RB ( E ),
85 indexed directory
86 .RB ( I ),
87 inline data
88 .RB ( N ),
89 and verity
90 .RB ( V ).
91 .PP
92 Not all flags are supported or utilized by all file systems; refer to
93 file system-specific man pages such as
94 .BR btrfs (5),
95 .BR ext4 (5),
96 .BR mkfs.f2fs (8),
97 and
98 .BR xfs (5)
99 for more file system-specific details.
100 .SH OPTIONS
101 .TP
102 .B \-R
103 Recursively change attributes of directories and their contents.
104 .TP
105 .B \-V
106 Be verbose with chattr's output and print the program version.
107 .TP
108 .B \-f
109 Suppress most error messages.
110 .TP
111 .BI \-v " version"
112 Set the file's version/generation number.
113 .TP
114 .BI \-p " project"
115 Set the file's project number.
116 .SH ATTRIBUTES
117 .TP
118 .B a
119 A file with the 'a' attribute set can only be opened in append mode for
120 writing.  Only the superuser or a process possessing the
121 CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
122 .TP
123 .B A
124 When a file with the 'A' attribute set is accessed, its atime record is
125 not modified.  This avoids a certain amount of disk I/O for laptop
126 systems.
127 .TP
128 .B c
129 A file with the 'c' attribute set is automatically compressed on the disk
130 by the kernel.  A read from this file returns uncompressed data.  A write to
131 this file compresses data before storing them on the disk.  Note: please
132 make sure to read the bugs and limitations section at the end of this
133 document.  (Note: For btrfs, If the 'c' flag is set, then the 'C' flag
134 cannot be set. Also conflicts with btrfs mount option 'nodatasum')
135 .TP
136 .B C
137 A file with the 'C' attribute set will not be subject to copy-on-write
138 updates.  This flag is only supported on file systems which perform
139 copy-on-write.  (Note: For btrfs, the 'C' flag should be
140 set on new or empty files.  If it is set on a file which already has
141 data blocks, it is undefined when the blocks assigned to the file will
142 be fully stable.  If the 'C' flag is set on a directory, it will have no
143 effect on the directory, but new files created in that directory will
144 have the No_COW attribute set. If the 'C' flag is set, then the 'c' flag
145 cannot be set.)
146 .TP
147 .B d
148 A file with the 'd' attribute set is not a candidate for backup when the
149 .BR dump (8)
150 program is run.
151 .TP
152 .B D
153 When a directory with the 'D' attribute set is modified,
154 the changes are written synchronously to the disk; this is equivalent to
155 the 'dirsync' mount option applied to a subset of the files.
156 .TP
157 .B e
158 The 'e' attribute indicates that the file is using extents for mapping
159 the blocks on disk.  It may not be removed using
160 .BR chattr (1).
161 .TP
162 .B E
163 A file, directory, or symlink with the 'E' attribute set is encrypted by the
164 file system.  This attribute may not be set or cleared using
165 .BR chattr (1),
166 although it can be displayed by
167 .BR lsattr (1).
168 .TP
169 .B F
170 A directory with the 'F' attribute set indicates that all the path
171 lookups inside that directory are made in a case-insensitive fashion.
172 This attribute can only be changed in empty directories on file systems
173 with the casefold feature enabled.
174 .TP
175 .B i
176 A file with the 'i' attribute cannot be modified: it cannot be deleted or
177 renamed, no link can be created to this file, most of the file's
178 metadata can not be modified, and the file can not be opened in write mode.
179 Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE
180 capability can set or clear this attribute.
181 .TP
182 .B I
183 The 'I' attribute is used by the htree code to indicate that a directory
184 is being indexed using hashed trees.  It may not be set or cleared using
185 .BR chattr (1),
186 although it can be displayed by
187 .BR lsattr (1).
188 .TP
189 .B j
190 A file with the 'j' attribute has all of its data written to the ext3 or
191 ext4 journal before being written to the file itself, if the file system
192 is mounted with the "data=ordered" or "data=writeback" options and the
193 file system has a journal.  When the file system is mounted with the
194 "data=journal" option all file data is already journalled and this
195 attribute has no effect.  Only the superuser or a process possessing the
196 CAP_SYS_RESOURCE capability can set or clear this attribute.
197 .TP
198 .B m
199 A file with the 'm' attribute is excluded from compression on file
200 systems that support per-file compression.
201 .TP
202 .B N
203 A file with the 'N' attribute set indicates that the file has data
204 stored inline, within the inode itself. It may not be set or cleared
205 using
206 .BR chattr (1),
207 although it can be displayed by
208 .BR lsattr (1).
209 .TP
210 .B P
211 A directory with the 'P' attribute set will enforce a hierarchical
212 structure for project id's.  This means that files and directories created
213 in the directory will inherit the project id of the directory, rename
214 operations are constrained so when a file or directory is moved into
215 another directory, that the project ids must match.  In addition, a
216 hard link to file can only be created when the project id for the file
217 and the destination directory match.
218 .TP
219 .B s
220 When a file with the 's' attribute set is deleted, its blocks are zeroed
221 and written back to the disk.  Note: please make sure to read the bugs
222 and limitations section at the end of this document.
223 .TP
224 .B S
225 When a file with the 'S' attribute set is modified,
226 the changes are written synchronously to the disk; this is equivalent to
227 the 'sync' mount option applied to a subset of the files.
228 .TP
229 .B t
230 A file with the 't' attribute will not have a partial block fragment at
231 the end of the file merged with other files (for those file systems which
232 support tail-merging).  This is necessary for applications such as LILO
233 which read the file system directly, and which don't understand tail-merged
234 files.  Note: As of this writing, the ext2, ext3, and ext4 file systems do
235 not support tail-merging.
236 .TP
237 .B T
238 A directory with the 'T' attribute will be deemed to be the top of
239 directory hierarchies for the purposes of the Orlov block allocator.
240 This is a hint to the block allocator used by ext3 and ext4 that the
241 subdirectories under this directory are not related, and thus should be
242 spread apart for allocation purposes.   For example it is a very good
243 idea to set the 'T' attribute on the /home directory, so that /home/john
244 and /home/mary are placed into separate block groups.  For directories
245 where this attribute is not set, the Orlov block allocator will try to
246 group subdirectories closer together where possible.
247 .TP
248 .B u
249 When a file with the 'u' attribute set is deleted, its contents are
250 saved.  This allows the user to ask for its undeletion.  Note: please
251 make sure to read the bugs and limitations section at the end of this
252 document.
253 .TP
254 .B x
255 A file with the 'x' requests the use of direct access (dax) mode, if the
256 kernel supports DAX.  This can be overridden by the 'dax=never' mount
257 option.  For more information see the kernel documentation for dax:
258 <https://www.kernel.org/doc/html/latest/filesystems/dax.html>.
259 .IP
260 If the attribute is set on an existing directory, it will be inherited
261 by all files and subdirectories that are subsequently created in the
262 directory.  If an existing directory has contained some files and
263 subdirectories, modifying the attribute on the parent directory doesn't
264 change the attributes on these files and subdirectories.
265 .TP
266 .B V
267 A file with the 'V' attribute set has fs-verity enabled.  It cannot be
268 written to, and the file system will automatically verify all data read
269 from it against a cryptographic hash that covers the entire file's
270 contents, e.g. via a Merkle tree.  This makes it possible to efficiently
271 authenticate the file.  This attribute may not be set or cleared using
272 .BR chattr (1),
273 although it can be displayed by
274 .BR lsattr (1).
275 .PP
276 .SH AUTHOR
277 .B chattr
278 was written by Remy Card <Remy.Card@linux.org>.  It is currently being
279 maintained by Theodore Ts'o <tytso@alum.mit.edu>.
280 .SH BUGS AND LIMITATIONS
281 The 'c', 's',  and 'u' attributes are not honored
282 by the ext2, ext3, and ext4 file systems as implemented in the current
283 mainline Linux kernels.
284 Setting 'a' and 'i' attributes will not affect the ability to write
285 to already existing file descriptors.
286 .PP
287 The 'j' option is only useful for ext3 and ext4 file systems.
288 .PP
289 The 'D' option is only useful on Linux kernel 2.5.19 and later.
290 .SH AVAILABILITY
291 .B chattr
292 is part of the e2fsprogs package and is available from
293 http://e2fsprogs.sourceforge.net.
294 .SH SEE ALSO
295 .BR lsattr (1),
296 .BR btrfs (5),
297 .BR ext4 (5),
298 .BR mkfs.f2fs (8),
299 .BR xfs (5).