]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - misc/chattr.1.in
Add project ID support for chattr/lsattr
[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 'aAcCdDeijsStTu' 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 secure deletion (s),
43 synchronous updates (S),
44 no tail-merging (t),
45 top of directory hierarchy (T),
46 and undeletable (u).
47 .PP
48 The following attributes are read-only, and may be listed by
49 .BR lsattr (1)
50 but not modified by chattr:
51 compression error (E),
52 huge file (h),
53 indexed directory (I),
54 inline data (N),
55 compression raw access (X),
56 and compressed dirty file (Z).
57 .PP
58 Not all flags are supported or utilized by all filesystems; refer to
59 filesystem-specific man pages such as
60 .BR btrfs (5),
61 .BR ext4 (5),
62 and
63 .BR xfs (5)
64 for more filesystem-specific details.
65 .SH OPTIONS
66 .TP
67 .B \-R
68 Recursively change attributes of directories and their contents.
69 .TP
70 .B \-V
71 Be verbose with chattr's output and print the program version.
72 .TP
73 .B \-f
74 Suppress most error messages.
75 .TP
76 .BI \-v " version"
77 Set the file's version/generation number.
78 .TP
79 .BI \-p " project"
80 Set the file's project number.
81 .SH ATTRIBUTES
82 A file with the 'a' attribute set can only be open in append mode for writing.
83 Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE
84 capability can set or clear this attribute.
85 .PP
86 When a file with the 'A' attribute set is accessed, its atime record is
87 not modified. This avoids a certain amount of disk I/O for laptop
88 systems.
89 .PP
90 A file with the 'c' attribute set is automatically compressed on the disk
91 by the kernel. A read from this file returns uncompressed data. A write to
92 this file compresses data before storing them on the disk. Note: please
93 make sure to read the bugs and limitations section at the end of this
94 document.
95 .PP
96 A file with the 'C' attribute set will not be subject to copy-on-write
97 updates. This flag is only supported on file systems which perform
98 copy-on-write. (Note: For btrfs, the 'C' flag should be
99 set on new or empty files. If it is set on a file which already has
100 data blocks, it is undefined when the blocks assigned to the file will
101 be fully stable. If the 'C' flag is set on a directory, it will have no
102 effect on the directory, but new files created in that directory will
103 have the No_COW attribute set.)
104 .PP
105 A file with the 'd' attribute set is not candidate for backup when the
106 .BR dump (8)
107 program is run.
108 .PP
109 When a directory with the 'D' attribute set is modified,
110 the changes are written synchronously on the disk; this is equivalent to
111 the 'dirsync' mount option applied to a subset of the files.
112 .PP
113 The 'e' attribute indicates that the file is using extents for mapping
114 the blocks on disk. It may not be removed using
115 .BR chattr (1).
116 .PP
117 The 'E' attribute is used by the experimental encryption patches to
118 indicate that the file has been encrypted. It may not be
119 set or reset using
120 .BR chattr (1),
121 although it can be displayed by
122 .BR lsattr (1).
123 .PP
124 The 'h' attribute indicates the file is storing its blocks in units of the
125 filesystem blocksize instead of in units of sectors, and means that the file
126 is (or at one time was) larger than 2TB. It may not be set or reset using
127 .BR chattr (1),
128 although it can be displayed by
129 .BR lsattr (1).
130 .PP
131 A file with the 'i' attribute cannot be modified: it cannot be deleted or
132 renamed, no link can be created to this file and no data can be written
133 to the file. Only the superuser or a process possessing the
134 CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
135 .PP
136 The 'I' attribute is used by the htree code to indicate that a directory
137 is being indexed using hashed trees. It may not be set or reset using
138 .BR chattr (1),
139 although it can be displayed by
140 .BR lsattr (1).
141 .PP
142 A file with the 'j' attribute has all of its data written to the ext3
143 or ext4 journal before being written to the file itself, if the filesystem
144 is mounted with the "data=ordered" or "data=writeback" options. When the
145 filesystem is mounted with the "data=journal" option all file data
146 is already journalled and this attribute has no effect. Only
147 the superuser or a process possessing the CAP_SYS_RESOURCE
148 capability can set or clear this attribute.
149 .PP
150 A file with the 'N' attribute set indicates that the file has data
151 stored inline, within the inode itself. It may not be set or reset using
152 .BR chattr (1),
153 although it can be displayed by
154 .BR lsattr (1).
155 .PP
156 When a file with the 's' attribute set is deleted, its blocks are zeroed
157 and written back to the disk. Note: please make sure to read the bugs
158 and limitations section at the end of this document.
159 .PP
160 When a file with the 'S' attribute set is modified,
161 the changes are written synchronously on the disk; this is equivalent to
162 the 'sync' mount option applied to a subset of the files.
163 .PP
164 A file with the 't' attribute will not have a partial block fragment at
165 the end of the file merged with other files (for those filesystems which
166 support tail-merging). This is necessary for applications such as LILO
167 which read the filesystem directly, and which don't understand tail-merged
168 files. Note: As of this writing, the ext2 or ext3 filesystems do not
169 (yet, except in very experimental patches) support tail-merging.
170 .PP
171 A directory with the 'T' attribute will be deemed to be the top of
172 directory hierarchies for the purposes of the Orlov block allocator.
173 This is a hint to the block allocator used by ext3 and ext4 that the
174 subdirectories under this directory are not related, and thus should be
175 spread apart for allocation purposes. For example it is a very good
176 idea to set the 'T' attribute on the /home directory, so that /home/john
177 and /home/mary are placed into separate block groups. For directories
178 where this attribute is not set, the Orlov block allocator will try to
179 group subdirectories closer together where possible.
180 .PP
181 When a file with the 'u' attribute set is deleted, its contents are
182 saved. This allows the user to ask for its undeletion. Note: please
183 make sure to read the bugs and limitations section at the end of this
184 document.
185 .PP
186 The 'X' attribute is used by the experimental compression patches to
187 indicate that the raw contents of a compressed file can be accessed
188 directly. It currently may not be set or reset using
189 .BR chattr (1),
190 although it can be displayed by
191 .BR lsattr (1).
192 .PP
193 The 'Z' attribute is used by the experimental compression patches to
194 indicate a compressed file is dirty. It may not be set or reset using
195 .BR chattr (1),
196 although it can be displayed by
197 .BR lsattr (1).
198 .PP
199 .SH AUTHOR
200 .B chattr
201 was written by Remy Card <Remy.Card@linux.org>. It is currently being
202 maintained by Theodore Ts'o <tytso@alum.mit.edu>.
203 .SH BUGS AND LIMITATIONS
204 The 'c', 's', and 'u' attributes are not honored
205 by the ext2, ext3, and ext4 filesystems as implemented in the current
206 mainline Linux kernels.
207 .PP
208 The 'j' option is only useful if the filesystem is mounted as ext3 or ext4.
209 .PP
210 The 'D' option is only useful on Linux kernel 2.5.19 and later.
211 .SH AVAILABILITY
212 .B chattr
213 is part of the e2fsprogs package and is available from
214 http://e2fsprogs.sourceforge.net.
215 .SH SEE ALSO
216 .BR lsattr (1),
217 .BR btrfs (5),
218 .BR ext4 (5),
219 .BR xfs (5).