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 mode is +-=[aAcCdDeijsStTu].
28 The operator '+' causes the selected attributes to be added to the
29 existing attributes of the files; '-' causes them to be removed; and '='
30 causes them to be the only attributes that the files have.
32 The letters 'aAcCdDeijPsStTu' select the new attributes for the files:
38 synchronous directory updates (D),
42 project hierarchy (P),
44 synchronous updates (S),
46 top of directory hierarchy (T),
49 The following attributes are read-only, and may be listed by
51 but not modified by chattr:
52 compression error (E),
54 indexed directory (I),
56 compression raw access (X),
57 and compressed dirty file (Z).
59 Not all flags are supported or utilized by all filesystems; refer to
60 filesystem-specific man pages such as
65 for more filesystem-specific details.
69 Recursively change attributes of directories and their contents.
72 Be verbose with chattr's output and print the program version.
75 Suppress most error messages.
78 Set the file's version/generation number.
81 Set the file's project number.
83 A file with the 'a' attribute set can only be open in append mode for writing.
84 Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE
85 capability can set or clear this attribute.
87 When a file with the 'A' attribute set is accessed, its atime record is
88 not modified. This avoids a certain amount of disk I/O for laptop
91 A file with the 'c' attribute set is automatically compressed on the disk
92 by the kernel. A read from this file returns uncompressed data. A write to
93 this file compresses data before storing them on the disk. Note: please
94 make sure to read the bugs and limitations section at the end of this
97 A file with the 'C' attribute set will not be subject to copy-on-write
98 updates. This flag is only supported on file systems which perform
99 copy-on-write. (Note: For btrfs, the 'C' flag should be
100 set on new or empty files. If it is set on a file which already has
101 data blocks, it is undefined when the blocks assigned to the file will
102 be fully stable. If the 'C' flag is set on a directory, it will have no
103 effect on the directory, but new files created in that directory will
104 have the No_COW attribute set.)
106 A file with the 'd' attribute set is not candidate for backup when the
110 When a directory with the 'D' attribute set is modified,
111 the changes are written synchronously on the disk; this is equivalent to
112 the 'dirsync' mount option applied to a subset of the files.
114 The 'e' attribute indicates that the file is using extents for mapping
115 the blocks on disk. It may not be removed using
118 The 'E' attribute is used by the experimental encryption patches to
119 indicate that the file has been encrypted. It may not be
122 although it can be displayed by
125 The 'h' attribute indicates the file is storing its blocks in units of the
126 filesystem blocksize instead of in units of sectors, and means that the file
127 is (or at one time was) larger than 2TB. It may not be set or reset using
129 although it can be displayed by
132 A file with the 'i' attribute cannot be modified: it cannot be deleted or
133 renamed, no link can be created to this file and no data can be written
134 to the file. Only the superuser or a process possessing the
135 CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
137 The 'I' attribute is used by the htree code to indicate that a directory
138 is being indexed using hashed trees. It may not be set or reset using
140 although it can be displayed by
143 A file with the 'j' attribute has all of its data written to the ext3
144 or ext4 journal before being written to the file itself, if the filesystem
145 is mounted with the "data=ordered" or "data=writeback" options. When the
146 filesystem is mounted with the "data=journal" option all file data
147 is already journalled and this attribute has no effect. Only
148 the superuser or a process possessing the CAP_SYS_RESOURCE
149 capability can set or clear this attribute.
151 A file with the 'N' attribute set indicates that the file has data
152 stored inline, within the inode itself. It may not be set or reset using
154 although it can be displayed by
157 A directory with the 'P' attribute set will enforce a hierarchical
158 structure for project id's. This means that files and directory created
159 in the directory will inherit the project id of the directory, rename
160 operations are constrained so when a file or directory is moved into
161 another directory, that the project id's much match. In addition, a
162 hard link to file can only be created when the project id for the file
163 and the destination directory match.
165 When a file with the 's' attribute set is deleted, its blocks are zeroed
166 and written back to the disk. Note: please make sure to read the bugs
167 and limitations section at the end of this document.
169 When a file with the 'S' attribute set is modified,
170 the changes are written synchronously on the disk; this is equivalent to
171 the 'sync' mount option applied to a subset of the files.
173 A file with the 't' attribute will not have a partial block fragment at
174 the end of the file merged with other files (for those filesystems which
175 support tail-merging). This is necessary for applications such as LILO
176 which read the filesystem directly, and which don't understand tail-merged
177 files. Note: As of this writing, the ext2 or ext3 filesystems do not
178 (yet, except in very experimental patches) support tail-merging.
180 A directory with the 'T' attribute will be deemed to be the top of
181 directory hierarchies for the purposes of the Orlov block allocator.
182 This is a hint to the block allocator used by ext3 and ext4 that the
183 subdirectories under this directory are not related, and thus should be
184 spread apart for allocation purposes. For example it is a very good
185 idea to set the 'T' attribute on the /home directory, so that /home/john
186 and /home/mary are placed into separate block groups. For directories
187 where this attribute is not set, the Orlov block allocator will try to
188 group subdirectories closer together where possible.
190 When a file with the 'u' attribute set is deleted, its contents are
191 saved. This allows the user to ask for its undeletion. Note: please
192 make sure to read the bugs and limitations section at the end of this
195 The 'X' attribute is used by the experimental compression patches to
196 indicate that the raw contents of a compressed file can be accessed
197 directly. It currently may not be set or reset using
199 although it can be displayed by
202 The 'Z' attribute is used by the experimental compression patches to
203 indicate a compressed file is dirty. It may not be set or reset using
205 although it can be displayed by
210 was written by Remy Card <Remy.Card@linux.org>. It is currently being
211 maintained by Theodore Ts'o <tytso@alum.mit.edu>.
212 .SH BUGS AND LIMITATIONS
213 The 'c', 's', and 'u' attributes are not honored
214 by the ext2, ext3, and ext4 filesystems as implemented in the current
215 mainline Linux kernels.
217 The 'j' option is only useful if the filesystem is mounted as ext3 or ext4.
219 The 'D' option is only useful on Linux kernel 2.5.19 and later.
222 is part of the e2fsprogs package and is available from
223 http://e2fsprogs.sourceforge.net.