]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - misc/chattr.1.in
Merge branch 'maint' into next
[thirdparty/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 +-=[aAcCdDeijsStTu].
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 'aAcCdDeijPsStTu' 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 immutable (i),
41 data journalling (j),
42 project hierarchy (P),
43 secure deletion (s),
44 synchronous updates (S),
45 no tail-merging (t),
46 top of directory hierarchy (T),
47 and undeletable (u).
48 .PP
49 The following attributes are read-only, and may be listed by
50 .BR lsattr (1)
51 but not modified by chattr:
52 compression error (E),
53 huge file (h),
54 indexed directory (I),
55 inline data (N),
56 compression raw access (X),
57 and compressed dirty file (Z).
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 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.
86 .PP
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
89 systems.
90 .PP
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
95 document.
96 .PP
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.)
105 .PP
106 A file with the 'd' attribute set is not candidate for backup when the
107 .BR dump (8)
108 program is run.
109 .PP
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.
113 .PP
114 The 'e' attribute indicates that the file is using extents for mapping
115 the blocks on disk. It may not be removed using
116 .BR chattr (1).
117 .PP
118 The 'E' attribute is used by the experimental encryption patches to
119 indicate that the file has been encrypted. It may not be
120 set or reset using
121 .BR chattr (1),
122 although it can be displayed by
123 .BR lsattr (1).
124 .PP
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
128 .BR chattr (1),
129 although it can be displayed by
130 .BR lsattr (1).
131 .PP
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.
136 .PP
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
139 .BR chattr (1),
140 although it can be displayed by
141 .BR lsattr (1).
142 .PP
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.
150 .PP
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
153 .BR chattr (1),
154 although it can be displayed by
155 .BR lsattr (1).
156 .PP
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.
164 .PP
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.
168 .PP
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.
172 .PP
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.
179 .PP
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.
189 .PP
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
193 document.
194 .PP
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
198 .BR chattr (1),
199 although it can be displayed by
200 .BR lsattr (1).
201 .PP
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
204 .BR chattr (1),
205 although it can be displayed by
206 .BR lsattr (1).
207 .PP
208 .SH AUTHOR
209 .B chattr
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.
216 .PP
217 The 'j' option is only useful if the filesystem is mounted as ext3 or ext4.
218 .PP
219 The 'D' option is only useful on Linux kernel 2.5.19 and later.
220 .SH AVAILABILITY
221 .B chattr
222 is part of the e2fsprogs package and is available from
223 http://e2fsprogs.sourceforge.net.
224 .SH SEE ALSO
225 .BR lsattr (1),
226 .BR btrfs (5),
227 .BR ext4 (5),
228 .BR xfs (5).