]>
Commit | Line | Data |
---|---|---|
3839e657 | 1 | .\" -*- nroff -*- |
74becf3c | 2 | .TH CHATTR 1 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" |
3839e657 | 3 | .SH NAME |
4f858546 | 4 | chattr \- change file attributes on a Linux file system |
3839e657 TT |
5 | .SH SYNOPSIS |
6 | .B chattr | |
7 | [ | |
e68594d2 | 8 | .B \-RVf |
3839e657 TT |
9 | ] |
10 | [ | |
caf8ce4c TT |
11 | .B \-v |
12 | .I version | |
3839e657 TT |
13 | ] |
14 | [ | |
3627e838 LX |
15 | .B \-p |
16 | .I project | |
17 | ] | |
18 | [ | |
caf8ce4c | 19 | .I mode |
3839e657 TT |
20 | ] |
21 | .I files... | |
22 | .SH DESCRIPTION | |
23 | .B chattr | |
4f858546 | 24 | changes the file attributes on a Linux file system. |
3839e657 | 25 | .PP |
4825daeb | 26 | The format of a symbolic mode is +-=[aAcCdDeijPsStTu]. |
3839e657 | 27 | .PP |
272258e1 | 28 | The operator '+' causes the selected attributes to be added to the |
a93a4c72 TT |
29 | existing attributes of the files; '-' causes them to be removed; and '=' |
30 | causes them to be the only attributes that the files have. | |
3839e657 | 31 | .PP |
75dd3c47 | 32 | The letters 'aAcCdDeijPsStTu' select the new attributes for the files: |
5b9aaae7 ES |
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), | |
bc8f1ae5 | 42 | project hierarchy (P), |
5b9aaae7 ES |
43 | secure deletion (s), |
44 | synchronous updates (S), | |
45 | no tail-merging (t), | |
46 | top of directory hierarchy (T), | |
47 | and undeletable (u). | |
312c2a40 ES |
48 | .PP |
49 | The following attributes are read-only, and may be listed by | |
50 | .BR lsattr (1) | |
5b9aaae7 | 51 | but not modified by chattr: |
4825daeb | 52 | encrypted (E), |
5b9aaae7 | 53 | indexed directory (I), |
4825daeb | 54 | and inline data (N). |
272258e1 ES |
55 | .PP |
56 | Not all flags are supported or utilized by all filesystems; refer to | |
57 | filesystem-specific man pages such as | |
58 | .BR btrfs (5), | |
59 | .BR ext4 (5), | |
60 | and | |
61 | .BR xfs (5) | |
62 | for more filesystem-specific details. | |
3839e657 TT |
63 | .SH OPTIONS |
64 | .TP | |
caf8ce4c | 65 | .B \-R |
3839e657 TT |
66 | Recursively change attributes of directories and their contents. |
67 | .TP | |
caf8ce4c | 68 | .B \-V |
a88fa0c0 | 69 | Be verbose with chattr's output and print the program version. |
3839e657 | 70 | .TP |
e68594d2 TT |
71 | .B \-f |
72 | Suppress most error messages. | |
73 | .TP | |
caf8ce4c | 74 | .BI \-v " version" |
e1a0a3e3 | 75 | Set the file's version/generation number. |
3627e838 LX |
76 | .TP |
77 | .BI \-p " project" | |
78 | Set the file's project number. | |
f3db3566 | 79 | .SH ATTRIBUTES |
272258e1 | 80 | A file with the 'a' attribute set can only be open in append mode for writing. |
0796e660 | 81 | Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE |
51f8f8d2 | 82 | capability can set or clear this attribute. |
a789d840 | 83 | .PP |
5b9aaae7 ES |
84 | When a file with the 'A' attribute set is accessed, its atime record is |
85 | not modified. This avoids a certain amount of disk I/O for laptop | |
86 | systems. | |
87 | .PP | |
272258e1 | 88 | A file with the 'c' attribute set is automatically compressed on the disk |
51f8f8d2 | 89 | by the kernel. A read from this file returns uncompressed data. A write to |
0796e660 | 90 | this file compresses data before storing them on the disk. Note: please |
1aa3d56a TT |
91 | make sure to read the bugs and limitations section at the end of this |
92 | document. | |
a789d840 | 93 | .PP |
0796e660 TT |
94 | A file with the 'C' attribute set will not be subject to copy-on-write |
95 | updates. This flag is only supported on file systems which perform | |
96 | copy-on-write. (Note: For btrfs, the 'C' flag should be | |
97 | set on new or empty files. If it is set on a file which already has | |
98 | data blocks, it is undefined when the blocks assigned to the file will | |
99 | be fully stable. If the 'C' flag is set on a directory, it will have no | |
100 | effect on the directory, but new files created in that directory will | |
5cb290e2 | 101 | have the No_COW attribute set.) |
0796e660 | 102 | .PP |
272258e1 | 103 | A file with the 'd' attribute set is not candidate for backup when the |
f3db3566 TT |
104 | .BR dump (8) |
105 | program is run. | |
a789d840 | 106 | .PP |
272258e1 | 107 | When a directory with the 'D' attribute set is modified, |
5b9aaae7 | 108 | the changes are written synchronously on the disk; this is equivalent to |
272258e1 | 109 | the 'dirsync' mount option applied to a subset of the files. |
023d111e | 110 | .PP |
a5e14ead | 111 | The 'e' attribute indicates that the file is using extents for mapping |
7c8da6e3 AK |
112 | the blocks on disk. It may not be removed using |
113 | .BR chattr (1). | |
a5e14ead | 114 | .PP |
22f22ab1 TT |
115 | The 'E' attribute is used by the experimental encryption patches to |
116 | indicate that the file has been encrypted. It may not be | |
5b9aaae7 | 117 | set or reset using |
51f8f8d2 TT |
118 | .BR chattr (1), |
119 | although it can be displayed by | |
120 | .BR lsattr (1). | |
121 | .PP | |
272258e1 | 122 | A file with the 'i' attribute cannot be modified: it cannot be deleted or |
f3db3566 | 123 | renamed, no link can be created to this file and no data can be written |
77be4d2d | 124 | to the file. Only the superuser or a process possessing the |
51f8f8d2 | 125 | CAP_LINUX_IMMUTABLE capability can set or clear this attribute. |
a789d840 | 126 | .PP |
5b9aaae7 ES |
127 | The 'I' attribute is used by the htree code to indicate that a directory |
128 | is being indexed using hashed trees. It may not be set or reset using | |
129 | .BR chattr (1), | |
130 | although it can be displayed by | |
131 | .BR lsattr (1). | |
132 | .PP | |
272258e1 | 133 | A file with the 'j' attribute has all of its data written to the ext3 |
c7c37754 ZL |
134 | or ext4 journal before being written to the file itself, if the filesystem |
135 | is mounted with the "data=ordered" or "data=writeback" options. When the | |
77be4d2d | 136 | filesystem is mounted with the "data=journal" option all file data |
0796e660 TT |
137 | is already journalled and this attribute has no effect. Only |
138 | the superuser or a process possessing the CAP_SYS_RESOURCE | |
51f8f8d2 | 139 | capability can set or clear this attribute. |
9a718849 | 140 | .PP |
272258e1 ES |
141 | A file with the 'N' attribute set indicates that the file has data |
142 | stored inline, within the inode itself. It may not be set or reset using | |
143 | .BR chattr (1), | |
144 | although it can be displayed by | |
145 | .BR lsattr (1). | |
146 | .PP | |
bc8f1ae5 TT |
147 | A directory with the 'P' attribute set will enforce a hierarchical |
148 | structure for project id's. This means that files and directory created | |
ce20096f | 149 | in the directory will inherit the project id of the directory, rename |
bc8f1ae5 TT |
150 | operations are constrained so when a file or directory is moved into |
151 | another directory, that the project id's much match. In addition, a | |
152 | hard link to file can only be created when the project id for the file | |
153 | and the destination directory match. | |
154 | .PP | |
272258e1 | 155 | When a file with the 's' attribute set is deleted, its blocks are zeroed |
1aa3d56a TT |
156 | and written back to the disk. Note: please make sure to read the bugs |
157 | and limitations section at the end of this document. | |
a789d840 | 158 | .PP |
272258e1 | 159 | When a file with the 'S' attribute set is modified, |
f3db3566 | 160 | the changes are written synchronously on the disk; this is equivalent to |
272258e1 | 161 | the 'sync' mount option applied to a subset of the files. |
a789d840 | 162 | .PP |
5b9aaae7 ES |
163 | A file with the 't' attribute will not have a partial block fragment at |
164 | the end of the file merged with other files (for those filesystems which | |
165 | support tail-merging). This is necessary for applications such as LILO | |
166 | which read the filesystem directly, and which don't understand tail-merged | |
167 | files. Note: As of this writing, the ext2 or ext3 filesystems do not | |
168 | (yet, except in very experimental patches) support tail-merging. | |
169 | .PP | |
0796e660 | 170 | A directory with the 'T' attribute will be deemed to be the top of |
27c3e539 TT |
171 | directory hierarchies for the purposes of the Orlov block allocator. |
172 | This is a hint to the block allocator used by ext3 and ext4 that the | |
173 | subdirectories under this directory are not related, and thus should be | |
174 | spread apart for allocation purposes. For example it is a very good | |
175 | idea to set the 'T' attribute on the /home directory, so that /home/john | |
176 | and /home/mary are placed into separate block groups. For directories | |
177 | where this attribute is not set, the Orlov block allocator will try to | |
1384cc64 | 178 | group subdirectories closer together where possible. |
15f9011a | 179 | .PP |
272258e1 | 180 | When a file with the 'u' attribute set is deleted, its contents are |
1aa3d56a TT |
181 | saved. This allows the user to ask for its undeletion. Note: please |
182 | make sure to read the bugs and limitations section at the end of this | |
183 | document. | |
a789d840 | 184 | .PP |
3839e657 TT |
185 | .SH AUTHOR |
186 | .B chattr | |
2e5a1b9e TT |
187 | was written by Remy Card <Remy.Card@linux.org>. It is currently being |
188 | maintained by Theodore Ts'o <tytso@alum.mit.edu>. | |
3839e657 | 189 | .SH BUGS AND LIMITATIONS |
272258e1 | 190 | The 'c', 's', and 'u' attributes are not honored |
25399080 TT |
191 | by the ext2, ext3, and ext4 filesystems as implemented in the current |
192 | mainline Linux kernels. | |
3839e657 | 193 | .PP |
272258e1 | 194 | The 'j' option is only useful if the filesystem is mounted as ext3 or ext4. |
88372d5c | 195 | .PP |
272258e1 | 196 | The 'D' option is only useful on Linux kernel 2.5.19 and later. |
3839e657 TT |
197 | .SH AVAILABILITY |
198 | .B chattr | |
6d56d51a TT |
199 | is part of the e2fsprogs package and is available from |
200 | http://e2fsprogs.sourceforge.net. | |
3839e657 | 201 | .SH SEE ALSO |
272258e1 ES |
202 | .BR lsattr (1), |
203 | .BR btrfs (5), | |
204 | .BR ext4 (5), | |
205 | .BR xfs (5). |