Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 1 | .\" -*- nroff -*- |
Theodore Ts'o | 74becf3 | 1997-04-26 14:37:06 +0000 | [diff] [blame] | 2 | .TH CHATTR 1 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@" |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 3 | .SH NAME |
Theodore Ts'o | 4f85854 | 2009-05-30 12:34:28 -0400 | [diff] [blame] | 4 | chattr \- change file attributes on a Linux file system |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 5 | .SH SYNOPSIS |
| 6 | .B chattr |
| 7 | [ |
Theodore Ts'o | e68594d | 2007-10-22 08:51:39 -0400 | [diff] [blame] | 8 | .B \-RVf |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 9 | ] |
| 10 | [ |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 11 | .B \-v |
| 12 | .I version |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 13 | ] |
| 14 | [ |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 15 | .I mode |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 16 | ] |
| 17 | .I files... |
| 18 | .SH DESCRIPTION |
| 19 | .B chattr |
Theodore Ts'o | 4f85854 | 2009-05-30 12:34:28 -0400 | [diff] [blame] | 20 | changes the file attributes on a Linux file system. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 21 | .PP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 22 | The format of a symbolic mode is +-=[acdeijstuACDST]. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 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 |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 28 | The letters `acdeijstuACDST' select the new attributes for the files: |
Eric Sandeen | 312c2a4 | 2009-05-27 23:23:43 -0500 | [diff] [blame] | 29 | append only (a), compressed (c), no dump (d), extent format (e), immutable (i), |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 30 | data journalling (j), secure deletion (s), no tail-merging (t), |
| 31 | undeletable (u), no atime updates (A), no copy on write (C), |
| 32 | synchronous directory updates (D), synchronous updates (S), |
| 33 | and top of directory hierarchy (T). |
Eric Sandeen | 312c2a4 | 2009-05-27 23:23:43 -0500 | [diff] [blame] | 34 | .PP |
| 35 | The following attributes are read-only, and may be listed by |
| 36 | .BR lsattr (1) |
| 37 | but not modified by chattr: huge file (h), compression error (E), |
| 38 | indexed directory (I), compression raw access (X), and compressed dirty |
| 39 | file (Z). |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 40 | .SH OPTIONS |
| 41 | .TP |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 42 | .B \-R |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 43 | Recursively change attributes of directories and their contents. |
| 44 | .TP |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 45 | .B \-V |
Theodore Ts'o | a88fa0c | 1999-01-05 07:02:39 +0000 | [diff] [blame] | 46 | Be verbose with chattr's output and print the program version. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 47 | .TP |
Theodore Ts'o | e68594d | 2007-10-22 08:51:39 -0400 | [diff] [blame] | 48 | .B \-f |
| 49 | Suppress most error messages. |
| 50 | .TP |
Theodore Ts'o | caf8ce4 | 1999-10-21 19:56:34 +0000 | [diff] [blame] | 51 | .BI \-v " version" |
Theodore Ts'o | e1a0a3e | 2000-02-11 05:00:19 +0000 | [diff] [blame] | 52 | Set the file's version/generation number. |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 53 | .SH ATTRIBUTES |
Theodore Ts'o | 5cfd740 | 2002-06-28 10:47:24 -0400 | [diff] [blame] | 54 | When a file with the 'A' attribute set is accessed, its atime record is |
Theodore Ts'o | 583ccdc | 1997-05-09 03:06:31 +0000 | [diff] [blame] | 55 | not modified. This avoids a certain amount of disk I/O for laptop |
Theodore Ts'o | 2ecc6fe | 1997-04-29 17:57:00 +0000 | [diff] [blame] | 56 | systems. |
Theodore Ts'o | a789d84 | 1998-03-30 01:20:55 +0000 | [diff] [blame] | 57 | .PP |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 58 | A file with the `a' attribute set can only be open in append mode for writing. |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 59 | Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE |
Theodore Ts'o | 51f8f8d | 2002-11-08 20:02:21 -0500 | [diff] [blame] | 60 | capability can set or clear this attribute. |
Theodore Ts'o | a789d84 | 1998-03-30 01:20:55 +0000 | [diff] [blame] | 61 | .PP |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 62 | A file with the `c' attribute set is automatically compressed on the disk |
Theodore Ts'o | 51f8f8d | 2002-11-08 20:02:21 -0500 | [diff] [blame] | 63 | by the kernel. A read from this file returns uncompressed data. A write to |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 64 | this file compresses data before storing them on the disk. Note: please |
Theodore Ts'o | 1aa3d56 | 2005-12-31 01:04:40 -0500 | [diff] [blame] | 65 | make sure to read the bugs and limitations section at the end of this |
| 66 | document. |
Theodore Ts'o | a789d84 | 1998-03-30 01:20:55 +0000 | [diff] [blame] | 67 | .PP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 68 | A file with the 'C' attribute set will not be subject to copy-on-write |
| 69 | updates. This flag is only supported on file systems which perform |
| 70 | copy-on-write. (Note: For btrfs, the 'C' flag should be |
| 71 | set on new or empty files. If it is set on a file which already has |
| 72 | data blocks, it is undefined when the blocks assigned to the file will |
| 73 | be fully stable. If the 'C' flag is set on a directory, it will have no |
| 74 | effect on the directory, but new files created in that directory will |
| 75 | the No_COW attribute.) |
| 76 | .PP |
Theodore Ts'o | 023d111 | 2002-08-17 14:44:56 -0400 | [diff] [blame] | 77 | When a directory with the `D' attribute set is modified, |
| 78 | the changes are written synchronously on the disk; this is equivalent to |
| 79 | the `dirsync' mount option applied to a subset of the files. |
| 80 | .PP |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 81 | A file with the `d' attribute set is not candidate for backup when the |
| 82 | .BR dump (8) |
| 83 | program is run. |
Theodore Ts'o | a789d84 | 1998-03-30 01:20:55 +0000 | [diff] [blame] | 84 | .PP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 85 | The 'E' attribute is used by the experimental compression patches to |
Theodore Ts'o | 023d111 | 2002-08-17 14:44:56 -0400 | [diff] [blame] | 86 | indicate that a compressed file has a compression error. It may not be |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 87 | set or reset using |
Theodore Ts'o | 023d111 | 2002-08-17 14:44:56 -0400 | [diff] [blame] | 88 | .BR chattr (1), |
| 89 | although it can be displayed by |
| 90 | .BR lsattr (1). |
| 91 | .PP |
Andreas Dilger | a5e14ea | 2008-08-24 20:24:23 -0400 | [diff] [blame] | 92 | The 'e' attribute indicates that the file is using extents for mapping |
Aneesh Kumar K.V | 7c8da6e | 2009-01-06 12:07:14 +0530 | [diff] [blame] | 93 | the blocks on disk. It may not be removed using |
| 94 | .BR chattr (1). |
Andreas Dilger | a5e14ea | 2008-08-24 20:24:23 -0400 | [diff] [blame] | 95 | .PP |
Theodore Ts'o | 51f8f8d | 2002-11-08 20:02:21 -0500 | [diff] [blame] | 96 | The 'I' attribute is used by the htree code to indicate that a directory |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 97 | is being indexed using hashed trees. It may not be set or reset using |
Theodore Ts'o | 51f8f8d | 2002-11-08 20:02:21 -0500 | [diff] [blame] | 98 | .BR chattr (1), |
| 99 | although it can be displayed by |
| 100 | .BR lsattr (1). |
| 101 | .PP |
Eric Sandeen | 312c2a4 | 2009-05-27 23:23:43 -0500 | [diff] [blame] | 102 | The 'h' attribute indicates the file is storing its blocks in units of the |
Andreas Dilger | a5e14ea | 2008-08-24 20:24:23 -0400 | [diff] [blame] | 103 | filesystem blocksize instead of in units of sectors, and means that the file |
| 104 | is (or at one time was) larger than 2TB. It may not be set or reset using |
| 105 | .BR chattr (1), |
| 106 | although it can be displayed by |
| 107 | .BR lsattr (1). |
| 108 | .PP |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 109 | A file with the `i' attribute cannot be modified: it cannot be deleted or |
| 110 | renamed, no link can be created to this file and no data can be written |
Theodore Ts'o | 77be4d2 | 2003-03-06 12:39:55 -0500 | [diff] [blame] | 111 | to the file. Only the superuser or a process possessing the |
Theodore Ts'o | 51f8f8d | 2002-11-08 20:02:21 -0500 | [diff] [blame] | 112 | CAP_LINUX_IMMUTABLE capability can set or clear this attribute. |
Theodore Ts'o | a789d84 | 1998-03-30 01:20:55 +0000 | [diff] [blame] | 113 | .PP |
Theodore Ts'o | 9a71884 | 2000-12-31 13:48:12 +0000 | [diff] [blame] | 114 | A file with the `j' attribute has all of its data written to the ext3 |
| 115 | journal before being written to the file itself, if the filesystem is |
| 116 | mounted with the "data=ordered" or "data=writeback" options. When the |
Theodore Ts'o | 77be4d2 | 2003-03-06 12:39:55 -0500 | [diff] [blame] | 117 | filesystem is mounted with the "data=journal" option all file data |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 118 | is already journalled and this attribute has no effect. Only |
| 119 | the superuser or a process possessing the CAP_SYS_RESOURCE |
Theodore Ts'o | 51f8f8d | 2002-11-08 20:02:21 -0500 | [diff] [blame] | 120 | capability can set or clear this attribute. |
Theodore Ts'o | 9a71884 | 2000-12-31 13:48:12 +0000 | [diff] [blame] | 121 | .PP |
Theodore Ts'o | 1aa3d56 | 2005-12-31 01:04:40 -0500 | [diff] [blame] | 122 | When a file with the `s' attribute set is deleted, its blocks are zeroed |
| 123 | and written back to the disk. Note: please make sure to read the bugs |
| 124 | and limitations section at the end of this document. |
Theodore Ts'o | a789d84 | 1998-03-30 01:20:55 +0000 | [diff] [blame] | 125 | .PP |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 126 | When a file with the `S' attribute set is modified, |
| 127 | the changes are written synchronously on the disk; this is equivalent to |
| 128 | the `sync' mount option applied to a subset of the files. |
Theodore Ts'o | a789d84 | 1998-03-30 01:20:55 +0000 | [diff] [blame] | 129 | .PP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 130 | A directory with the 'T' attribute will be deemed to be the top of |
Theodore Ts'o | 27c3e53 | 2009-04-21 22:18:19 -0400 | [diff] [blame] | 131 | directory hierarchies for the purposes of the Orlov block allocator. |
| 132 | This is a hint to the block allocator used by ext3 and ext4 that the |
| 133 | subdirectories under this directory are not related, and thus should be |
| 134 | spread apart for allocation purposes. For example it is a very good |
| 135 | idea to set the 'T' attribute on the /home directory, so that /home/john |
| 136 | and /home/mary are placed into separate block groups. For directories |
| 137 | where this attribute is not set, the Orlov block allocator will try to |
Theodore Ts'o | 1384cc6 | 2009-06-02 09:02:39 -0400 | [diff] [blame] | 138 | group subdirectories closer together where possible. |
Theodore Ts'o | 15f9011 | 2002-11-01 01:53:52 -0500 | [diff] [blame] | 139 | .PP |
Theodore Ts'o | b3f5b4c | 2001-11-05 19:22:02 -0500 | [diff] [blame] | 140 | A file with the 't' attribute will not have a partial block fragment at |
Theodore Ts'o | fc05eb0 | 2003-03-25 23:02:34 -0500 | [diff] [blame] | 141 | the end of the file merged with other files (for those filesystems which |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 142 | support tail-merging). This is necessary for applications such as LILO |
Theodore Ts'o | fc05eb0 | 2003-03-25 23:02:34 -0500 | [diff] [blame] | 143 | which read the filesystem directly, and which don't understand tail-merged |
| 144 | files. Note: As of this writing, the ext2 or ext3 filesystems do not |
| 145 | (yet, except in very experimental patches) support tail-merging. |
Theodore Ts'o | b3f5b4c | 2001-11-05 19:22:02 -0500 | [diff] [blame] | 146 | .PP |
Theodore Ts'o | 1aa3d56 | 2005-12-31 01:04:40 -0500 | [diff] [blame] | 147 | When a file with the `u' attribute set is deleted, its contents are |
| 148 | saved. This allows the user to ask for its undeletion. Note: please |
| 149 | make sure to read the bugs and limitations section at the end of this |
| 150 | document. |
Theodore Ts'o | a789d84 | 1998-03-30 01:20:55 +0000 | [diff] [blame] | 151 | .PP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 152 | The 'X' attribute is used by the experimental compression patches to |
Theodore Ts'o | 023d111 | 2002-08-17 14:44:56 -0400 | [diff] [blame] | 153 | indicate that a raw contents of a compressed file can be accessed |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 154 | directly. It currently may not be set or reset using |
Theodore Ts'o | 023d111 | 2002-08-17 14:44:56 -0400 | [diff] [blame] | 155 | .BR chattr (1), |
| 156 | although it can be displayed by |
| 157 | .BR lsattr (1). |
| 158 | .PP |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 159 | The 'Z' attribute is used by the experimental compression patches to |
| 160 | indicate a compressed file is dirty. It may not be set or reset using |
Theodore Ts'o | 023d111 | 2002-08-17 14:44:56 -0400 | [diff] [blame] | 161 | .BR chattr (1), |
| 162 | although it can be displayed by |
| 163 | .BR lsattr (1). |
| 164 | .PP |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 165 | .SH AUTHOR |
| 166 | .B chattr |
Theodore Ts'o | 2e5a1b9 | 2004-01-31 20:27:36 -0500 | [diff] [blame] | 167 | was written by Remy Card <Remy.Card@linux.org>. It is currently being |
| 168 | maintained by Theodore Ts'o <tytso@alum.mit.edu>. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 169 | .SH BUGS AND LIMITATIONS |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 170 | The `c', 's', and `u' attributes are not honored |
| 171 | by the ext2, ext3, and ext4 filesystems as implemented in the current |
| 172 | mainline Linux kernels. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 173 | .PP |
Theodore Ts'o | 9a71884 | 2000-12-31 13:48:12 +0000 | [diff] [blame] | 174 | The `j' option is only useful if the filesystem is mounted as ext3. |
Theodore Ts'o | 88372d5 | 2002-06-15 18:58:39 -0400 | [diff] [blame] | 175 | .PP |
| 176 | The `D' option is only useful on Linux kernel 2.5.19 and later. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 177 | .SH AVAILABILITY |
| 178 | .B chattr |
Theodore Ts'o | 6d56d51 | 2001-05-12 15:46:21 +0000 | [diff] [blame] | 179 | is part of the e2fsprogs package and is available from |
| 180 | http://e2fsprogs.sourceforge.net. |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 181 | .SH SEE ALSO |
| 182 | .BR lsattr (1) |