OSDN Git Service

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