CHATTR(1) CHATTR(1)
NAME
chattr - change file(1,n) attributes on a Linux second extended file(1,n) system
SYNOPSIS
chattr [ -RV ] [ -v version(1,3,5) ] [ mode ] files...
DESCRIPTION
chattr changes the file(1,n) attributes on a Linux second extended file(1,n) sys-
tem.
The format of a symbolic mode is +-=[ASacDdIijsTtu].
The operator `+' causes the selected attributes to be added to the
existing attributes of the files; `-' causes them to be removed; and
`=' causes them to be the only attributes that the files have.
The letters `acdijsuADST' select(2,7,2 select_tut) the new attributes for the files:
append only (a), compressed (c), no dump (d), immutable (i), data jour-
nalling (j), secure deletion (s), no tail-merging (t), undeletable (u),
no atime updates (A), synchronous directory updates (D), synchronous
updates (S), and top of directory hierarchy (T).
OPTIONS
-R Recursively change attributes of directories and their contents.
Symbolic links encountered during recursive directory traversals
are ignored.
-V Be verbose with chattr's output and print the program version.
-v version(1,3,5)
Set the file(1,n)'s version(1,3,5)/generation number.
ATTRIBUTES
When a file(1,n) with the 'A' attribute set(7,n,1 builtins) is accessed, its atime record is
not modified. This avoids a certain amount of disk I/O for laptop sys-
tems.
A file(1,n) with the `a' attribute set(7,n,1 builtins) can only be open(2,3,n) in(1,8) append mode for
writing. Only the superuser or a process possessing the
CAP_LINUX_IMMUTABLE capability can set(7,n,1 builtins) or clear(1,3x,3x clrtobot) this attribute.
A file(1,n) with the `c' attribute set(7,n,1 builtins) is automatically compressed on the
disk by the kernel. A read(2,n,1 builtins) from this file(1,n) returns uncompressed data.
A write(1,2) to this file(1,n) compresses data before storing them on the disk.
When a directory with the `D' attribute set(7,n,1 builtins) is modified, the changes
are written synchronously on the disk; this is equivalent to the
`dirsync' mount(2,8) option applied to a subset of the files.
A file(1,n) with the `d' attribute set(7,n,1 builtins) is not candidate for backup when the
dump(8) program is run.
The 'E' attribute is used by the experimental compression patches to
indicate that a compressed file(1,n) has a compression error. It may not be
set(7,n,1 builtins) or reset(1,7,1 tput) using chattr(1), although it can be displayed by
lsattr(1).
The 'I' attribute is used by the htree code to indicate that a direc-
tory is behind indexed using hashed trees. It may not be set(7,n,1 builtins) or reset(1,7,1 tput)
using chattr(1), although it can be displayed by lsattr(1).
A file(1,n) with the `i' attribute cannot be modified: it cannot be deleted
or renamed, no link(1,2) can be created to this file(1,n) and no data can be
written to the file. Only the superuser or a process possessing the
CAP_LINUX_IMMUTABLE capability can set(7,n,1 builtins) or clear(1,3x,3x clrtobot) this attribute.
A file(1,n) with the `j' attribute has all of its data written to the ext3
journal before being written to the file(1,n) itself, if(3,n) the filesystem is
mounted with the "data=ordered" or "data=writeback" options. When the
filesystem is mounted with the "data=journal" option all file(1,n) data is
already journalled and this attribute has no effect. Only the supe-
ruser or a process possessing the CAP_SYS_RESOURCE capability can set(7,n,1 builtins)
or clear(1,3x,3x clrtobot) this attribute.
When a file(1,n) with the `s' attribute set(7,n,1 builtins) is deleted, its blocks are
zeroed and written back to the disk.
When a file(1,n) with the `S' attribute set(7,n,1 builtins) is modified, the changes are
written synchronously on the disk; this is equivalent to the `sync(1,2,8)'
mount(2,8) option applied to a subset of the files.
A directory with the 'T' attribute will be deemed to be the top of
directory hierarchies for the purposes of the Orlov block allocator
(which is used in(1,8) on systems with Linux 2.5.46 or later).
A file(1,n) with the 't' attribute will not have a partial block fragment at
the end of the file(1,n) merged with other files (for those filesystems
which support tail-merging). This is necessary for applications such
as LILO which read(2,n,1 builtins) the filesystem directly, and which don't understand
tail-merged files. Note: As of this writing, the ext2 or ext3 filesys-
tems do not (yet, except in(1,8) very experimental patches) support tail-
merging.
When a file(1,n) with the `u' attribute set(7,n,1 builtins) is deleted, its contents are
saved. This allows the user to ask for its undeletion.
The 'X' attribute is used by the experimental compression patches to
indicate that a raw(3x,7,8,3x cbreak) contents of a compressed file(1,n) can be accessed
directly. It currently may not be set(7,n,1 builtins) or reset(1,7,1 tput) using chattr(1),
although it can be displayed by lsattr(1).
The 'Z' attribute is used by the experimental compression patches to
indicate a compressed file(1,n) is dirty. It may not be set(7,n,1 builtins) or reset(1,7,1 tput) using
chattr(1), although it can be displayed by lsattr(1).
AUTHOR
chattr was written by Remy Card <Remy.Card@linux.org>. It is currently
being maintained by Theodore Ts'o <tytso@alum.mit.edu>.
BUGS AND LIMITATIONS
The `c', 's', and `u' attributes are not honored by the ext2 and ext3
filesystems as implemented in(1,8) the current mainline Linux kernels.
These attributes may be implemented in(1,8) future versions ext2 and ext3.
The `j' option is only useful if(3,n) the filesystem is mounted as ext3.
The `D' option is only useful on Linux kernel 2.5.19 and later.
AVAILABILITY
chattr is part of the e2fsprogs package and is available from
http://e2fsprogs.sourceforge.net.
SEE ALSO
lsattr(1)
E2fsprogs version(1,3,5) 1.35 February 2004 CHATTR(1)