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