2 .TH CHATTR 1 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
4 chattr \- change file attributes on a Linux file system
24 changes the file attributes on a Linux file system.
26 The format of a symbolic
29 .BR +-= [ aAcCdDeFijmPsStTux ].
33 causes the selected attributes to be added to the
34 existing attributes of the files;
36 causes them to be removed; and
38 causes them to be the only attributes that the files have.
41 .RB ' aAcCdDeFijmPsStTux '
42 select the new attributes for the files:
53 synchronous directory updates
57 case-insensitive directory lookups
73 top of directory hierarchy
77 and direct access for files
80 The following attributes are read-only, and may be listed by
82 but not modified by chattr:
92 Not all flags are supported or utilized by all file systems; refer to
93 file system-specific man pages such as
99 for more file system-specific details.
103 Recursively change attributes of directories and their contents.
106 Be verbose with chattr's output and print the program version.
109 Suppress most error messages.
112 Set the file's version/generation number.
115 Set the file's project number.
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.
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
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')
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
148 A file with the 'd' attribute set is not a candidate for backup when the
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.
158 The 'e' attribute indicates that the file is using extents for mapping
159 the blocks on disk. It may not be removed using
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
166 although it can be displayed by
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.
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.
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
186 although it can be displayed by
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.
199 A file with the 'm' attribute is excluded from compression on file
200 systems that support per-file compression.
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
207 although it can be displayed by
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.
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.
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.
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.
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.
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
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>.
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.
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
273 although it can be displayed by
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.
287 The 'j' option is only useful for ext3 and ext4 file systems.
289 The 'D' option is only useful on Linux kernel 2.5.19 and later.
292 is part of the e2fsprogs package and is available from
293 http://e2fsprogs.sourceforge.net.