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