]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - misc/chattr.1.in
ext2fs: rename "s_overhead_blocks" to "s_overhead_clusters"
[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 3.SH NAME
4f858546 4chattr \- change file attributes on a Linux file system
3839e657
TT
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[
3627e838
LX
15.B \-p
16.I project
17]
18[
caf8ce4c 19.I mode
3839e657
TT
20]
21.I files...
22.SH DESCRIPTION
23.B chattr
4f858546 24changes the file attributes on a Linux file system.
3839e657 25.PP
6e587046 26The format of a symbolic mode is +-=[aAcCdDeFijPsStTu].
3839e657 27.PP
272258e1 28The operator '+' causes the selected attributes to be added to the
a93a4c72
TT
29existing attributes of the files; '-' causes them to be removed; and '='
30causes them to be the only attributes that the files have.
3839e657 31.PP
1378bb65 32The letters 'aAcCdDeFijPsStTu' select the new attributes for the files:
5b9aaae7
ES
33append only (a),
34no atime updates (A),
35compressed (c),
36no copy on write (C),
37no dump (d),
38synchronous directory updates (D),
39extent format (e),
1378bb65 40case-insensitive directory lookups (F),
5b9aaae7
ES
41immutable (i),
42data journalling (j),
bc8f1ae5 43project hierarchy (P),
5b9aaae7
ES
44secure deletion (s),
45synchronous updates (S),
46no tail-merging (t),
47top of directory hierarchy (T),
48and undeletable (u).
312c2a40
ES
49.PP
50The following attributes are read-only, and may be listed by
51.BR lsattr (1)
5b9aaae7 52but not modified by chattr:
4825daeb 53encrypted (E),
5b9aaae7 54indexed directory (I),
be335e31
EB
55inline data (N),
56and verity (V).
272258e1
ES
57.PP
58Not all flags are supported or utilized by all filesystems; refer to
59filesystem-specific man pages such as
60.BR btrfs (5),
61.BR ext4 (5),
62and
63.BR xfs (5)
64for more filesystem-specific details.
3839e657
TT
65.SH OPTIONS
66.TP
caf8ce4c 67.B \-R
3839e657
TT
68Recursively change attributes of directories and their contents.
69.TP
caf8ce4c 70.B \-V
a88fa0c0 71Be verbose with chattr's output and print the program version.
3839e657 72.TP
e68594d2
TT
73.B \-f
74Suppress most error messages.
75.TP
caf8ce4c 76.BI \-v " version"
e1a0a3e3 77Set the file's version/generation number.
3627e838
LX
78.TP
79.BI \-p " project"
80Set the file's project number.
f3db3566 81.SH ATTRIBUTES
26d6e57c
EB
82A file with the 'a' attribute set can only be opened in append mode for
83writing. Only the superuser or a process possessing the
84CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
a789d840 85.PP
5b9aaae7
ES
86When a file with the 'A' attribute set is accessed, its atime record is
87not modified. This avoids a certain amount of disk I/O for laptop
88systems.
89.PP
272258e1 90A file with the 'c' attribute set is automatically compressed on the disk
51f8f8d2 91by the kernel. A read from this file returns uncompressed data. A write to
0796e660 92this file compresses data before storing them on the disk. Note: please
1aa3d56a
TT
93make sure to read the bugs and limitations section at the end of this
94document.
a789d840 95.PP
0796e660
TT
96A file with the 'C' attribute set will not be subject to copy-on-write
97updates. This flag is only supported on file systems which perform
98copy-on-write. (Note: For btrfs, the 'C' flag should be
99set on new or empty files. If it is set on a file which already has
100data blocks, it is undefined when the blocks assigned to the file will
101be fully stable. If the 'C' flag is set on a directory, it will have no
102effect on the directory, but new files created in that directory will
5cb290e2 103have the No_COW attribute set.)
0796e660 104.PP
26d6e57c 105A file with the 'd' attribute set is not a candidate for backup when the
f3db3566
TT
106.BR dump (8)
107program is run.
a789d840 108.PP
272258e1 109When a directory with the 'D' attribute set is modified,
26d6e57c 110the changes are written synchronously to the disk; this is equivalent to
272258e1 111the 'dirsync' mount option applied to a subset of the files.
023d111e 112.PP
a5e14ead 113The 'e' attribute indicates that the file is using extents for mapping
7c8da6e3
AK
114the blocks on disk. It may not be removed using
115.BR chattr (1).
a5e14ead 116.PP
93cea435 117A file, directory, or symlink with the 'E' attribute set is encrypted by the
446483e3 118filesystem. This attribute may not be set or cleared using
51f8f8d2
TT
119.BR chattr (1),
120although it can be displayed by
121.BR lsattr (1).
122.PP
1378bb65
GKB
123A directory with the 'F' attribute set indicates that all the path
124lookups inside that directory are made in a case-insensitive fashion.
125This attribute can only be changed in empty directories on file systems
28887533 126with the casefold feature enabled.
1378bb65 127.PP
272258e1 128A file with the 'i' attribute cannot be modified: it cannot be deleted or
46cf3712 129renamed, no link can be created to this file, most of the file's
d3f01729
LC
130metadata can not be modified, and the file can not be opened in write mode.
131Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE
132capability can set or clear this attribute.
a789d840 133.PP
5b9aaae7 134The 'I' attribute is used by the htree code to indicate that a directory
446483e3 135is being indexed using hashed trees. It may not be set or cleared using
5b9aaae7
ES
136.BR chattr (1),
137although it can be displayed by
138.BR lsattr (1).
139.PP
46cf3712
TT
140A file with the 'j' attribute has all of its data written to the ext3 or
141ext4 journal before being written to the file itself, if the file system
142is mounted with the "data=ordered" or "data=writeback" options and the
143file system has a journal. When the filesystem is mounted with the
144"data=journal" option all file data is already journalled and this
145attribute has no effect. Only the superuser or a process possessing the
146CAP_SYS_RESOURCE capability can set or clear this attribute.
9a718849 147.PP
272258e1 148A file with the 'N' attribute set indicates that the file has data
446483e3
EB
149stored inline, within the inode itself. It may not be set or cleared
150using
272258e1
ES
151.BR chattr (1),
152although it can be displayed by
153.BR lsattr (1).
154.PP
bc8f1ae5
TT
155A directory with the 'P' attribute set will enforce a hierarchical
156structure for project id's. This means that files and directory created
ce20096f 157in the directory will inherit the project id of the directory, rename
bc8f1ae5
TT
158operations are constrained so when a file or directory is moved into
159another directory, that the project id's much match. In addition, a
160hard link to file can only be created when the project id for the file
161and the destination directory match.
162.PP
272258e1 163When a file with the 's' attribute set is deleted, its blocks are zeroed
1aa3d56a
TT
164and written back to the disk. Note: please make sure to read the bugs
165and limitations section at the end of this document.
a789d840 166.PP
272258e1 167When a file with the 'S' attribute set is modified,
26d6e57c 168the changes are written synchronously to the disk; this is equivalent to
272258e1 169the 'sync' mount option applied to a subset of the files.
a789d840 170.PP
5b9aaae7
ES
171A file with the 't' attribute will not have a partial block fragment at
172the end of the file merged with other files (for those filesystems which
173support tail-merging). This is necessary for applications such as LILO
174which read the filesystem directly, and which don't understand tail-merged
f08f1c64
EB
175files. Note: As of this writing, the ext2, ext3, and ext4 filesystems do
176not support tail-merging.
5b9aaae7 177.PP
0796e660 178A directory with the 'T' attribute will be deemed to be the top of
27c3e539
TT
179directory hierarchies for the purposes of the Orlov block allocator.
180This is a hint to the block allocator used by ext3 and ext4 that the
181subdirectories under this directory are not related, and thus should be
182spread apart for allocation purposes. For example it is a very good
183idea to set the 'T' attribute on the /home directory, so that /home/john
184and /home/mary are placed into separate block groups. For directories
185where this attribute is not set, the Orlov block allocator will try to
1384cc64 186group subdirectories closer together where possible.
15f9011a 187.PP
272258e1 188When a file with the 'u' attribute set is deleted, its contents are
1aa3d56a
TT
189saved. This allows the user to ask for its undeletion. Note: please
190make sure to read the bugs and limitations section at the end of this
191document.
a789d840 192.PP
be335e31
EB
193A file with the 'V' attribute set has fs-verity enabled. It cannot be
194written to, and the filesystem will automatically verify all data read
195from it against a cryptographic hash that covers the entire file's
196contents, e.g. via a Merkle tree. This makes it possible to efficiently
446483e3 197authenticate the file. This attribute may not be set or cleared using
be335e31
EB
198.BR chattr (1),
199although it can be displayed by
200.BR lsattr (1).
201.PP
3839e657
TT
202.SH AUTHOR
203.B chattr
2e5a1b9e
TT
204was written by Remy Card <Remy.Card@linux.org>. It is currently being
205maintained by Theodore Ts'o <tytso@alum.mit.edu>.
3839e657 206.SH BUGS AND LIMITATIONS
272258e1 207The 'c', 's', and 'u' attributes are not honored
25399080
TT
208by the ext2, ext3, and ext4 filesystems as implemented in the current
209mainline Linux kernels.
d3f01729
LC
210Setting 'a' and 'i' attributes will not affect the ability to write
211to already existing file descriptors.
3839e657 212.PP
46cf3712 213The 'j' option is only useful for ext3 and ext4 file systems.
88372d5c 214.PP
272258e1 215The 'D' option is only useful on Linux kernel 2.5.19 and later.
3839e657
TT
216.SH AVAILABILITY
217.B chattr
6d56d51a
TT
218is part of the e2fsprogs package and is available from
219http://e2fsprogs.sourceforge.net.
3839e657 220.SH SEE ALSO
272258e1
ES
221.BR lsattr (1),
222.BR btrfs (5),
223.BR ext4 (5),
224.BR xfs (5).