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