]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - misc/chattr.1.in
e2fsck: use unsigned values for memory tracking stats
[thirdparty/e2fsprogs.git] / misc / chattr.1.in
CommitLineData
3839e657 1.\" -*- nroff -*-
74becf3c 2.TH CHATTR 1 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
3839e657
TT
3.SH NAME
4chattr \- change file attributes on a Linux second extended file system
5.SH SYNOPSIS
6.B chattr
7[
e68594d2 8.B \-RVf
3839e657
TT
9]
10[
caf8ce4c
TT
11.B \-v
12.I version
3839e657
TT
13]
14[
caf8ce4c 15.I mode
3839e657
TT
16]
17.I files...
18.SH DESCRIPTION
19.B chattr
583ccdc3 20changes the file attributes on a Linux second extended file system.
3839e657 21.PP
51f8f8d2 22The format of a symbolic mode is +-=[ASacDdIijsTtu].
3839e657
TT
23.PP
24The operator `+' causes the selected attributes to be added to the
25existing attributes of the files; `-' causes them to be removed; and
26`=' causes them to be the only attributes that the files have.
27.PP
2e5a1b9e
TT
28The letters `acdijsuADST' select the new attributes for the files:
29append only (a), compressed (c), no dump (d), immutable (i),
30data journalling (j), secure deletion (s), no tail-merging (t),
31undeletable (u), no atime updates (A), synchronous directory updates (D),
32synchronous updates (S), and top of directory hierarchy (T).
3839e657
TT
33.SH OPTIONS
34.TP
caf8ce4c 35.B \-R
3839e657
TT
36Recursively change attributes of directories and their contents.
37.TP
caf8ce4c 38.B \-V
a88fa0c0 39Be verbose with chattr's output and print the program version.
3839e657 40.TP
e68594d2
TT
41.B \-f
42Suppress most error messages.
43.TP
caf8ce4c 44.BI \-v " version"
e1a0a3e3 45Set the file's version/generation number.
f3db3566 46.SH ATTRIBUTES
5cfd7404 47When a file with the 'A' attribute set is accessed, its atime record is
583ccdc3 48not modified. This avoids a certain amount of disk I/O for laptop
2ecc6fef 49systems.
a789d840 50.PP
f3db3566 51A file with the `a' attribute set can only be open in append mode for writing.
77be4d2d 52Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE
51f8f8d2 53capability can set or clear this attribute.
a789d840 54.PP
f3db3566 55A file with the `c' attribute set is automatically compressed on the disk
51f8f8d2 56by the kernel. A read from this file returns uncompressed data. A write to
1aa3d56a
TT
57this file compresses data before storing them on the disk. Note: please
58make sure to read the bugs and limitations section at the end of this
59document.
a789d840 60.PP
023d111e
TT
61When a directory with the `D' attribute set is modified,
62the changes are written synchronously on the disk; this is equivalent to
63the `dirsync' mount option applied to a subset of the files.
64.PP
f3db3566
TT
65A file with the `d' attribute set is not candidate for backup when the
66.BR dump (8)
67program is run.
a789d840 68.PP
023d111e
TT
69The 'E' attribute is used by the experimental compression patches to
70indicate that a compressed file has a compression error. It may not be
71set or reset using
72.BR chattr (1),
73although it can be displayed by
74.BR lsattr (1).
75.PP
a5e14ead
AD
76The 'e' attribute indicates that the file is using extents for mapping
77the blocks on disk. It may not be set or reset using
78.BR chattr (1),
79although it can be displayed by
80.BR lsattr (1).
81.PP
51f8f8d2 82The 'I' attribute is used by the htree code to indicate that a directory
e71be1c8 83is being indexed using hashed trees. It may not be set or reset using
51f8f8d2
TT
84.BR chattr (1),
85although it can be displayed by
86.BR lsattr (1).
87.PP
a5e14ead
AD
88The 'H' attribute indicates the file is storing its blocks in units of the
89filesystem blocksize instead of in units of sectors, and means that the file
90is (or at one time was) larger than 2TB. It may not be set or reset using
91.BR chattr (1),
92although it can be displayed by
93.BR lsattr (1).
94.PP
f3db3566
TT
95A file with the `i' attribute cannot be modified: it cannot be deleted or
96renamed, no link can be created to this file and no data can be written
77be4d2d 97to the file. Only the superuser or a process possessing the
51f8f8d2 98CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
a789d840 99.PP
9a718849
TT
100A file with the `j' attribute has all of its data written to the ext3
101journal before being written to the file itself, if the filesystem is
102mounted with the "data=ordered" or "data=writeback" options. When the
77be4d2d 103filesystem is mounted with the "data=journal" option all file data
51f8f8d2
TT
104is already journalled and this attribute has no effect.
105Only the superuser or a process possessing the CAP_SYS_RESOURCE
106capability can set or clear this attribute.
9a718849 107.PP
1aa3d56a
TT
108When a file with the `s' attribute set is deleted, its blocks are zeroed
109and written back to the disk. Note: please make sure to read the bugs
110and limitations section at the end of this document.
a789d840 111.PP
f3db3566
TT
112When a file with the `S' attribute set is modified,
113the changes are written synchronously on the disk; this is equivalent to
114the `sync' mount option applied to a subset of the files.
a789d840 115.PP
15f9011a 116A directory with the 'T' attribute will be deemed to be the top of
27c3e539
TT
117directory hierarchies for the purposes of the Orlov block allocator.
118This is a hint to the block allocator used by ext3 and ext4 that the
119subdirectories under this directory are not related, and thus should be
120spread apart for allocation purposes. For example it is a very good
121idea to set the 'T' attribute on the /home directory, so that /home/john
122and /home/mary are placed into separate block groups. For directories
123where this attribute is not set, the Orlov block allocator will try to
124group subdirectories closer together where posible.
15f9011a 125.PP
b3f5b4c2 126A file with the 't' attribute will not have a partial block fragment at
fc05eb08 127the end of the file merged with other files (for those filesystems which
b3f5b4c2 128support tail-merging). This is necessary for applications such as LILO
fc05eb08
TT
129which read the filesystem directly, and which don't understand tail-merged
130files. Note: As of this writing, the ext2 or ext3 filesystems do not
131(yet, except in very experimental patches) support tail-merging.
b3f5b4c2 132.PP
1aa3d56a
TT
133When a file with the `u' attribute set is deleted, its contents are
134saved. This allows the user to ask for its undeletion. Note: please
135make sure to read the bugs and limitations section at the end of this
136document.
a789d840 137.PP
023d111e
TT
138The 'X' attribute is used by the experimental compression patches to
139indicate that a raw contents of a compressed file can be accessed
140directly. It currently may not be set or reset using
141.BR chattr (1),
142although it can be displayed by
143.BR lsattr (1).
144.PP
145The 'Z' attribute is used by the experimental compression patches to
146indicate a compressed file is dirty. It may not be set or reset using
147.BR chattr (1),
148although it can be displayed by
149.BR lsattr (1).
150.PP
3839e657
TT
151.SH AUTHOR
152.B chattr
2e5a1b9e
TT
153was written by Remy Card <Remy.Card@linux.org>. It is currently being
154maintained by Theodore Ts'o <tytso@alum.mit.edu>.
3839e657 155.SH BUGS AND LIMITATIONS
cf119027
TT
156The `c', 's', and `u' attributes are not honored
157by the ext2 and ext3 filesystems as implemented in the current mainline
158Linux kernels. These attributes may be implemented
1aa3d56a 159in future versions of the ext2 and ext3 filesystems.
3839e657 160.PP
9a718849 161The `j' option is only useful if the filesystem is mounted as ext3.
88372d5c
TT
162.PP
163The `D' option is only useful on Linux kernel 2.5.19 and later.
3839e657
TT
164.SH AVAILABILITY
165.B chattr
6d56d51a
TT
166is part of the e2fsprogs package and is available from
167http://e2fsprogs.sourceforge.net.
3839e657
TT
168.SH SEE ALSO
169.BR lsattr (1)