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