1CHATTR(1) General Commands Manual CHATTR(1)
2
3
4
6 chattr - change file attributes on a Linux second extended file system
7
9 chattr [ -RV ] [ -v version ] [ mode ] files...
10
12 chattr changes the file attributes on a Linux second extended file sys‐
13 tem.
14
15 The format of a symbolic mode is +-=[ASacDdIijsTtu].
16
17 The operator `+' causes the selected attributes to be added to the
18 existing attributes of the files; `-' causes them to be removed; and
19 `=' causes them to be the only attributes that the files have.
20
21 The letters `acdijsuADST' select the new attributes for the files:
22 append only (a), compressed (c), no dump (d), immutable (i), data jour‐
23 nalling (j), secure deletion (s), no tail-merging (t), undeletable (u),
24 no atime updates (A), synchronous directory updates (D), synchronous
25 updates (S), and top of directory hierarchy (T).
26
28 -R Recursively change attributes of directories and their contents.
29 Symbolic links encountered during recursive directory traversals
30 are ignored.
31
32 -V Be verbose with chattr's output and print the program version.
33
34 -v version
35 Set the file's version/generation number.
36
38 When a file with the 'A' attribute set is accessed, its atime record is
39 not modified. This avoids a certain amount of disk I/O for laptop sys‐
40 tems.
41
42 A file with the `a' attribute set can only be open in append mode for
43 writing. Only the superuser or a process possessing the
44 CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
45
46 A file with the `c' attribute set is automatically compressed on the
47 disk by the kernel. A read from this file returns uncompressed data.
48 A write to this file compresses data before storing them on the disk.
49 Note: please make sure to read the bugs and limitations section at the
50 end of this document.
51
52 When a directory with the `D' attribute set is modified, the changes
53 are written synchronously on the disk; this is equivalent to the
54 `dirsync' mount option applied to a subset of the files.
55
56 A file with the `d' attribute set is not candidate for backup when the
57 dump(8) program is run.
58
59 The 'E' attribute is used by the experimental compression patches to
60 indicate that a compressed file has a compression error. It may not be
61 set or reset using chattr(1), although it can be displayed by
62 lsattr(1).
63
64 The 'I' attribute is used by the htree code to indicate that a direc‐
65 tory is being indexed using hashed trees. It may not be set or reset
66 using chattr(1), although it can be displayed by lsattr(1).
67
68 A file with the `i' attribute cannot be modified: it cannot be deleted
69 or renamed, no link can be created to this file and no data can be
70 written to the file. Only the superuser or a process possessing the
71 CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
72
73 A file with the `j' attribute has all of its data written to the ext3
74 journal before being written to the file itself, if the filesystem is
75 mounted with the "data=ordered" or "data=writeback" options. When the
76 filesystem is mounted with the "data=journal" option all file data is
77 already journalled and this attribute has no effect. Only the supe‐
78 ruser or a process possessing the CAP_SYS_RESOURCE capability can set
79 or clear this attribute.
80
81 When a file with the `s' attribute set is deleted, its blocks are
82 zeroed and written back to the disk. Note: please make sure to read
83 the bugs and limitations section at the end of this document.
84
85 When a file with the `S' attribute set is modified, the changes are
86 written synchronously on the disk; this is equivalent to the `sync'
87 mount option applied to a subset of the files.
88
89 A directory with the 'T' attribute will be deemed to be the top of
90 directory hierarchies for the purposes of the Orlov block allocator
91 (which is used in on systems with Linux 2.5.46 or later).
92
93 A file with the 't' attribute will not have a partial block fragment at
94 the end of the file merged with other files (for those filesystems
95 which support tail-merging). This is necessary for applications such
96 as LILO which read the filesystem directly, and which don't understand
97 tail-merged files. Note: As of this writing, the ext2 or ext3 filesys‐
98 tems do not (yet, except in very experimental patches) support tail-
99 merging.
100
101 When a file with the `u' attribute set is deleted, its contents are
102 saved. This allows the user to ask for its undeletion. Note: please
103 make sure to read the bugs and limitations section at the end of this
104 document.
105
106 The 'X' attribute is used by the experimental compression patches to
107 indicate that a raw contents of a compressed file can be accessed
108 directly. It currently may not be set or reset using chattr(1),
109 although it can be displayed by lsattr(1).
110
111 The 'Z' attribute is used by the experimental compression patches to
112 indicate a compressed file is dirty. It may not be set or reset using
113 chattr(1), although it can be displayed by lsattr(1).
114
116 chattr was written by Remy Card <Remy.Card@linux.org>. It is currently
117 being maintained by Theodore Ts'o <tytso@alum.mit.edu>.
118
120 The `c', 's', and `u' attributes are not honored by the ext2 and ext3
121 filesystems as implemented in the current mainline Linux kernels.
122 These attributes may be implemented in future versions of the ext2 and
123 ext3 filesystems.
124
125 The `j' option is only useful if the filesystem is mounted as ext3.
126
127 The `D' option is only useful on Linux kernel 2.5.19 and later.
128
130 chattr is part of the e2fsprogs package and is available from
131 http://e2fsprogs.sourceforge.net.
132
134 lsattr(1)
135
136
137
138E2fsprogs version 1.40.2 July 2007 CHATTR(1)