blob: 2b48fb01426e06e1ca0c0a0e00436a139fe6edd8 [file] [log] [blame]
Theodore Ts'o3839e651997-04-26 13:21:57 +00001.\" -*- nroff -*-
Theodore Ts'o74becf31997-04-26 14:37:06 +00002.TH CHATTR 1 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
Theodore Ts'o3839e651997-04-26 13:21:57 +00003.SH NAME
4chattr \- change file attributes on a Linux second extended file system
5.SH SYNOPSIS
6.B chattr
7[
8.B \-RV
9]
10[
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000011.B \-v
12.I version
Theodore Ts'o3839e651997-04-26 13:21:57 +000013]
14[
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000015.I mode
Theodore Ts'o3839e651997-04-26 13:21:57 +000016]
17.I files...
18.SH DESCRIPTION
19.B chattr
Theodore Ts'o583ccdc1997-05-09 03:06:31 +000020changes the file attributes on a Linux second extended file system.
Theodore Ts'o3839e651997-04-26 13:21:57 +000021.PP
Theodore Ts'o51f8f8d2002-11-08 20:02:21 -050022The format of a symbolic mode is +-=[ASacDdIijsTtu].
Theodore Ts'o3839e651997-04-26 13:21:57 +000023.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
Theodore Ts'o2e5a1b92004-01-31 20:27:36 -050028The 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).
Theodore Ts'o3839e651997-04-26 13:21:57 +000033.SH OPTIONS
34.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000035.B \-R
Theodore Ts'o3839e651997-04-26 13:21:57 +000036Recursively change attributes of directories and their contents.
Theodore Ts'oa88fa0c1999-01-05 07:02:39 +000037Symbolic links encountered during recursive directory traversals are
38ignored.
Theodore Ts'o3839e651997-04-26 13:21:57 +000039.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000040.B \-V
Theodore Ts'oa88fa0c1999-01-05 07:02:39 +000041Be verbose with chattr's output and print the program version.
Theodore Ts'o3839e651997-04-26 13:21:57 +000042.TP
Theodore Ts'ocaf8ce41999-10-21 19:56:34 +000043.BI \-v " version"
Theodore Ts'oe1a0a3e2000-02-11 05:00:19 +000044Set the file's version/generation number.
Theodore Ts'of3db3561997-04-26 13:34:30 +000045.SH ATTRIBUTES
Theodore Ts'o5cfd7402002-06-28 10:47:24 -040046When a file with the 'A' attribute set is accessed, its atime record is
Theodore Ts'o583ccdc1997-05-09 03:06:31 +000047not modified. This avoids a certain amount of disk I/O for laptop
Theodore Ts'o2ecc6fe1997-04-29 17:57:00 +000048systems.
Theodore Ts'oa789d841998-03-30 01:20:55 +000049.PP
Theodore Ts'of3db3561997-04-26 13:34:30 +000050A file with the `a' attribute set can only be open in append mode for writing.
Theodore Ts'o77be4d22003-03-06 12:39:55 -050051Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE
Theodore Ts'o51f8f8d2002-11-08 20:02:21 -050052capability can set or clear this attribute.
Theodore Ts'oa789d841998-03-30 01:20:55 +000053.PP
Theodore Ts'of3db3561997-04-26 13:34:30 +000054A file with the `c' attribute set is automatically compressed on the disk
Theodore Ts'o51f8f8d2002-11-08 20:02:21 -050055by the kernel. A read from this file returns uncompressed data. A write to
Theodore Ts'o1aa3d562005-12-31 01:04:40 -050056this file compresses data before storing them on the disk. Note: please
57make sure to read the bugs and limitations section at the end of this
58document.
Theodore Ts'oa789d841998-03-30 01:20:55 +000059.PP
Theodore Ts'o023d1112002-08-17 14:44:56 -040060When a directory with the `D' attribute set is modified,
61the changes are written synchronously on the disk; this is equivalent to
62the `dirsync' mount option applied to a subset of the files.
63.PP
Theodore Ts'of3db3561997-04-26 13:34:30 +000064A file with the `d' attribute set is not candidate for backup when the
65.BR dump (8)
66program is run.
Theodore Ts'oa789d841998-03-30 01:20:55 +000067.PP
Theodore Ts'o023d1112002-08-17 14:44:56 -040068The 'E' attribute is used by the experimental compression patches to
69indicate that a compressed file has a compression error. It may not be
70set or reset using
71.BR chattr (1),
72although it can be displayed by
73.BR lsattr (1).
74.PP
Theodore Ts'o51f8f8d2002-11-08 20:02:21 -050075The 'I' attribute is used by the htree code to indicate that a directory
Theodore Ts'oe71be1c2006-07-15 21:55:33 -040076is being indexed using hashed trees. It may not be set or reset using
Theodore Ts'o51f8f8d2002-11-08 20:02:21 -050077.BR chattr (1),
78although it can be displayed by
79.BR lsattr (1).
80.PP
Theodore Ts'of3db3561997-04-26 13:34:30 +000081A file with the `i' attribute cannot be modified: it cannot be deleted or
82renamed, no link can be created to this file and no data can be written
Theodore Ts'o77be4d22003-03-06 12:39:55 -050083to the file. Only the superuser or a process possessing the
Theodore Ts'o51f8f8d2002-11-08 20:02:21 -050084CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
Theodore Ts'oa789d841998-03-30 01:20:55 +000085.PP
Theodore Ts'o9a718842000-12-31 13:48:12 +000086A file with the `j' attribute has all of its data written to the ext3
87journal before being written to the file itself, if the filesystem is
88mounted with the "data=ordered" or "data=writeback" options. When the
Theodore Ts'o77be4d22003-03-06 12:39:55 -050089filesystem is mounted with the "data=journal" option all file data
Theodore Ts'o51f8f8d2002-11-08 20:02:21 -050090is already journalled and this attribute has no effect.
91Only the superuser or a process possessing the CAP_SYS_RESOURCE
92capability can set or clear this attribute.
Theodore Ts'o9a718842000-12-31 13:48:12 +000093.PP
Theodore Ts'o1aa3d562005-12-31 01:04:40 -050094When a file with the `s' attribute set is deleted, its blocks are zeroed
95and written back to the disk. Note: please make sure to read the bugs
96and limitations section at the end of this document.
Theodore Ts'oa789d841998-03-30 01:20:55 +000097.PP
Theodore Ts'of3db3561997-04-26 13:34:30 +000098When a file with the `S' attribute set is modified,
99the changes are written synchronously on the disk; this is equivalent to
100the `sync' mount option applied to a subset of the files.
Theodore Ts'oa789d841998-03-30 01:20:55 +0000101.PP
Theodore Ts'o15f90112002-11-01 01:53:52 -0500102A directory with the 'T' attribute will be deemed to be the top of
103directory hierarchies for the purposes of the Orlov block allocator
Theodore Ts'o51f8f8d2002-11-08 20:02:21 -0500104(which is used in on systems with Linux 2.5.46 or later).
Theodore Ts'o15f90112002-11-01 01:53:52 -0500105.PP
Theodore Ts'ob3f5b4c2001-11-05 19:22:02 -0500106A file with the 't' attribute will not have a partial block fragment at
Theodore Ts'ofc05eb02003-03-25 23:02:34 -0500107the end of the file merged with other files (for those filesystems which
Theodore Ts'ob3f5b4c2001-11-05 19:22:02 -0500108support tail-merging). This is necessary for applications such as LILO
Theodore Ts'ofc05eb02003-03-25 23:02:34 -0500109which read the filesystem directly, and which don't understand tail-merged
110files. Note: As of this writing, the ext2 or ext3 filesystems do not
111(yet, except in very experimental patches) support tail-merging.
Theodore Ts'ob3f5b4c2001-11-05 19:22:02 -0500112.PP
Theodore Ts'o1aa3d562005-12-31 01:04:40 -0500113When a file with the `u' attribute set is deleted, its contents are
114saved. This allows the user to ask for its undeletion. Note: please
115make sure to read the bugs and limitations section at the end of this
116document.
Theodore Ts'oa789d841998-03-30 01:20:55 +0000117.PP
Theodore Ts'o023d1112002-08-17 14:44:56 -0400118The 'X' attribute is used by the experimental compression patches to
119indicate that a raw contents of a compressed file can be accessed
120directly. It currently may not be set or reset using
121.BR chattr (1),
122although it can be displayed by
123.BR lsattr (1).
124.PP
125The 'Z' attribute is used by the experimental compression patches to
126indicate a compressed file is dirty. It may not be set or reset using
127.BR chattr (1),
128although it can be displayed by
129.BR lsattr (1).
130.PP
Theodore Ts'o3839e651997-04-26 13:21:57 +0000131.SH AUTHOR
132.B chattr
Theodore Ts'o2e5a1b92004-01-31 20:27:36 -0500133was written by Remy Card <Remy.Card@linux.org>. It is currently being
134maintained by Theodore Ts'o <tytso@alum.mit.edu>.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000135.SH BUGS AND LIMITATIONS
Theodore Ts'ocf119022003-12-26 14:03:20 -0500136The `c', 's', and `u' attributes are not honored
137by the ext2 and ext3 filesystems as implemented in the current mainline
138Linux kernels. These attributes may be implemented
Theodore Ts'o1aa3d562005-12-31 01:04:40 -0500139in future versions of the ext2 and ext3 filesystems.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000140.PP
Theodore Ts'o9a718842000-12-31 13:48:12 +0000141The `j' option is only useful if the filesystem is mounted as ext3.
Theodore Ts'o88372d52002-06-15 18:58:39 -0400142.PP
143The `D' option is only useful on Linux kernel 2.5.19 and later.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000144.SH AVAILABILITY
145.B chattr
Theodore Ts'o6d56d512001-05-12 15:46:21 +0000146is part of the e2fsprogs package and is available from
147http://e2fsprogs.sourceforge.net.
Theodore Ts'o3839e651997-04-26 13:21:57 +0000148.SH SEE ALSO
149.BR lsattr (1)