1997-04-26 21:21:57 +08:00
|
|
|
.\" -*- nroff -*-
|
1997-04-26 22:37:06 +08:00
|
|
|
.TH CHATTR 1 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
|
1997-04-26 21:21:57 +08:00
|
|
|
.SH NAME
|
2009-05-31 00:34:28 +08:00
|
|
|
chattr \- change file attributes on a Linux file system
|
1997-04-26 21:21:57 +08:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.B chattr
|
|
|
|
[
|
2007-10-22 20:51:39 +08:00
|
|
|
.B \-RVf
|
1997-04-26 21:21:57 +08:00
|
|
|
]
|
|
|
|
[
|
Many files:
badblocks.8.in, chattr.1.in, dumpe2fs.8.in, e2label.8.in,
fsck.8.in, lsattr.1.in, mke2fs.8.in, mklost+found.8.in,
tune2fs.8.in, uuidgen.1.in: Update man page to use a more standard
format (bold option flags and italicized variables), as suggested by
Andreas Dilger (adilger@enel.ucalgary.ca)
ChangeLog, e2fsck.8.in:
e2fsck.8.in: Update man page to use a more standard format (bold
option flags and italicized variables), as suggested by Andreas Dilger
(adilger@enel.ucalgary.ca)
ChangeLog, uuid_generate.3.in:
uuid_generate.8.in: Update man page to use a more standard format
(bold option flags and italicized variables), as suggested by Andreas
Dilger (adilger@enel.ucalgary.ca)
1999-10-22 03:56:34 +08:00
|
|
|
.B \-v
|
|
|
|
.I version
|
1997-04-26 21:21:57 +08:00
|
|
|
]
|
|
|
|
[
|
Many files:
badblocks.8.in, chattr.1.in, dumpe2fs.8.in, e2label.8.in,
fsck.8.in, lsattr.1.in, mke2fs.8.in, mklost+found.8.in,
tune2fs.8.in, uuidgen.1.in: Update man page to use a more standard
format (bold option flags and italicized variables), as suggested by
Andreas Dilger (adilger@enel.ucalgary.ca)
ChangeLog, e2fsck.8.in:
e2fsck.8.in: Update man page to use a more standard format (bold
option flags and italicized variables), as suggested by Andreas Dilger
(adilger@enel.ucalgary.ca)
ChangeLog, uuid_generate.3.in:
uuid_generate.8.in: Update man page to use a more standard format
(bold option flags and italicized variables), as suggested by Andreas
Dilger (adilger@enel.ucalgary.ca)
1999-10-22 03:56:34 +08:00
|
|
|
.I mode
|
1997-04-26 21:21:57 +08:00
|
|
|
]
|
|
|
|
.I files...
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.B chattr
|
2009-05-31 00:34:28 +08:00
|
|
|
changes the file attributes on a Linux file system.
|
1997-04-26 21:21:57 +08:00
|
|
|
.PP
|
2014-07-05 11:02:59 +08:00
|
|
|
The format of a symbolic mode is +-=[aAcCdDeijsStTu].
|
1997-04-26 21:21:57 +08:00
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
The operator '+' causes the selected attributes to be added to the
|
2014-07-10 12:47:40 +08:00
|
|
|
existing attributes of the files; '-' causes them to be removed; and '='
|
|
|
|
causes them to be the only attributes that the files have.
|
1997-04-26 21:21:57 +08:00
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
The letters 'aAcCdDeijsStTu' select the new attributes for the files:
|
2014-07-05 11:02:59 +08:00
|
|
|
append only (a),
|
|
|
|
no atime updates (A),
|
|
|
|
compressed (c),
|
|
|
|
no copy on write (C),
|
|
|
|
no dump (d),
|
|
|
|
synchronous directory updates (D),
|
|
|
|
extent format (e),
|
|
|
|
immutable (i),
|
|
|
|
data journalling (j),
|
|
|
|
secure deletion (s),
|
|
|
|
synchronous updates (S),
|
|
|
|
no tail-merging (t),
|
|
|
|
top of directory hierarchy (T),
|
|
|
|
and undeletable (u).
|
2009-05-28 12:23:43 +08:00
|
|
|
.PP
|
|
|
|
The following attributes are read-only, and may be listed by
|
|
|
|
.BR lsattr (1)
|
2014-07-05 11:02:59 +08:00
|
|
|
but not modified by chattr:
|
|
|
|
compression error (E),
|
|
|
|
huge file (h),
|
|
|
|
indexed directory (I),
|
2014-07-05 11:03:14 +08:00
|
|
|
inline data (N),
|
2014-07-05 11:02:59 +08:00
|
|
|
compression raw access (X),
|
|
|
|
and compressed dirty file (Z).
|
2014-07-05 11:03:14 +08:00
|
|
|
.PP
|
|
|
|
Not all flags are supported or utilized by all filesystems; refer to
|
|
|
|
filesystem-specific man pages such as
|
|
|
|
.BR btrfs (5),
|
|
|
|
.BR ext4 (5),
|
|
|
|
and
|
|
|
|
.BR xfs (5)
|
|
|
|
for more filesystem-specific details.
|
1997-04-26 21:21:57 +08:00
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
Many files:
badblocks.8.in, chattr.1.in, dumpe2fs.8.in, e2label.8.in,
fsck.8.in, lsattr.1.in, mke2fs.8.in, mklost+found.8.in,
tune2fs.8.in, uuidgen.1.in: Update man page to use a more standard
format (bold option flags and italicized variables), as suggested by
Andreas Dilger (adilger@enel.ucalgary.ca)
ChangeLog, e2fsck.8.in:
e2fsck.8.in: Update man page to use a more standard format (bold
option flags and italicized variables), as suggested by Andreas Dilger
(adilger@enel.ucalgary.ca)
ChangeLog, uuid_generate.3.in:
uuid_generate.8.in: Update man page to use a more standard format
(bold option flags and italicized variables), as suggested by Andreas
Dilger (adilger@enel.ucalgary.ca)
1999-10-22 03:56:34 +08:00
|
|
|
.B \-R
|
1997-04-26 21:21:57 +08:00
|
|
|
Recursively change attributes of directories and their contents.
|
|
|
|
.TP
|
Many files:
badblocks.8.in, chattr.1.in, dumpe2fs.8.in, e2label.8.in,
fsck.8.in, lsattr.1.in, mke2fs.8.in, mklost+found.8.in,
tune2fs.8.in, uuidgen.1.in: Update man page to use a more standard
format (bold option flags and italicized variables), as suggested by
Andreas Dilger (adilger@enel.ucalgary.ca)
ChangeLog, e2fsck.8.in:
e2fsck.8.in: Update man page to use a more standard format (bold
option flags and italicized variables), as suggested by Andreas Dilger
(adilger@enel.ucalgary.ca)
ChangeLog, uuid_generate.3.in:
uuid_generate.8.in: Update man page to use a more standard format
(bold option flags and italicized variables), as suggested by Andreas
Dilger (adilger@enel.ucalgary.ca)
1999-10-22 03:56:34 +08:00
|
|
|
.B \-V
|
1999-01-05 15:02:39 +08:00
|
|
|
Be verbose with chattr's output and print the program version.
|
1997-04-26 21:21:57 +08:00
|
|
|
.TP
|
2007-10-22 20:51:39 +08:00
|
|
|
.B \-f
|
|
|
|
Suppress most error messages.
|
|
|
|
.TP
|
Many files:
badblocks.8.in, chattr.1.in, dumpe2fs.8.in, e2label.8.in,
fsck.8.in, lsattr.1.in, mke2fs.8.in, mklost+found.8.in,
tune2fs.8.in, uuidgen.1.in: Update man page to use a more standard
format (bold option flags and italicized variables), as suggested by
Andreas Dilger (adilger@enel.ucalgary.ca)
ChangeLog, e2fsck.8.in:
e2fsck.8.in: Update man page to use a more standard format (bold
option flags and italicized variables), as suggested by Andreas Dilger
(adilger@enel.ucalgary.ca)
ChangeLog, uuid_generate.3.in:
uuid_generate.8.in: Update man page to use a more standard format
(bold option flags and italicized variables), as suggested by Andreas
Dilger (adilger@enel.ucalgary.ca)
1999-10-22 03:56:34 +08:00
|
|
|
.BI \-v " version"
|
2000-02-11 13:00:19 +08:00
|
|
|
Set the file's version/generation number.
|
1997-04-26 21:34:30 +08:00
|
|
|
.SH ATTRIBUTES
|
2014-07-05 11:03:14 +08:00
|
|
|
A file with the 'a' attribute set can only be open in append mode for writing.
|
2012-06-13 05:09:39 +08:00
|
|
|
Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE
|
2002-11-09 09:02:21 +08:00
|
|
|
capability can set or clear this attribute.
|
1998-03-30 09:20:55 +08:00
|
|
|
.PP
|
2014-07-05 11:02:59 +08:00
|
|
|
When a file with the 'A' attribute set is accessed, its atime record is
|
|
|
|
not modified. This avoids a certain amount of disk I/O for laptop
|
|
|
|
systems.
|
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
A file with the 'c' attribute set is automatically compressed on the disk
|
2002-11-09 09:02:21 +08:00
|
|
|
by the kernel. A read from this file returns uncompressed data. A write to
|
2012-06-13 05:09:39 +08:00
|
|
|
this file compresses data before storing them on the disk. Note: please
|
2005-12-31 14:04:40 +08:00
|
|
|
make sure to read the bugs and limitations section at the end of this
|
|
|
|
document.
|
1998-03-30 09:20:55 +08:00
|
|
|
.PP
|
2012-06-13 05:09:39 +08:00
|
|
|
A file with the 'C' attribute set will not be subject to copy-on-write
|
|
|
|
updates. This flag is only supported on file systems which perform
|
|
|
|
copy-on-write. (Note: For btrfs, the 'C' flag should be
|
|
|
|
set on new or empty files. If it is set on a file which already has
|
|
|
|
data blocks, it is undefined when the blocks assigned to the file will
|
|
|
|
be fully stable. If the 'C' flag is set on a directory, it will have no
|
|
|
|
effect on the directory, but new files created in that directory will
|
2015-12-01 00:56:55 +08:00
|
|
|
have the No_COW attribute set.)
|
2012-06-13 05:09:39 +08:00
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
A file with the 'd' attribute set is not candidate for backup when the
|
1997-04-26 21:34:30 +08:00
|
|
|
.BR dump (8)
|
|
|
|
program is run.
|
1998-03-30 09:20:55 +08:00
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
When a directory with the 'D' attribute set is modified,
|
2014-07-05 11:02:59 +08:00
|
|
|
the changes are written synchronously on the disk; this is equivalent to
|
2014-07-05 11:03:14 +08:00
|
|
|
the 'dirsync' mount option applied to a subset of the files.
|
2002-08-18 02:44:56 +08:00
|
|
|
.PP
|
2008-08-25 08:24:23 +08:00
|
|
|
The 'e' attribute indicates that the file is using extents for mapping
|
2009-01-06 14:37:14 +08:00
|
|
|
the blocks on disk. It may not be removed using
|
|
|
|
.BR chattr (1).
|
2008-08-25 08:24:23 +08:00
|
|
|
.PP
|
2015-01-21 07:00:34 +08:00
|
|
|
The 'E' attribute is used by the experimental encryption patches to
|
|
|
|
indicate that the file has been encrypted. It may not be
|
2014-07-05 11:02:59 +08:00
|
|
|
set or reset using
|
2002-11-09 09:02:21 +08:00
|
|
|
.BR chattr (1),
|
|
|
|
although it can be displayed by
|
|
|
|
.BR lsattr (1).
|
|
|
|
.PP
|
2009-05-28 12:23:43 +08:00
|
|
|
The 'h' attribute indicates the file is storing its blocks in units of the
|
2008-08-25 08:24:23 +08:00
|
|
|
filesystem blocksize instead of in units of sectors, and means that the file
|
|
|
|
is (or at one time was) larger than 2TB. It may not be set or reset using
|
|
|
|
.BR chattr (1),
|
|
|
|
although it can be displayed by
|
|
|
|
.BR lsattr (1).
|
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
A file with the 'i' attribute cannot be modified: it cannot be deleted or
|
1997-04-26 21:34:30 +08:00
|
|
|
renamed, no link can be created to this file and no data can be written
|
2003-03-07 01:39:55 +08:00
|
|
|
to the file. Only the superuser or a process possessing the
|
2002-11-09 09:02:21 +08:00
|
|
|
CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
|
1998-03-30 09:20:55 +08:00
|
|
|
.PP
|
2014-07-05 11:02:59 +08:00
|
|
|
The 'I' attribute is used by the htree code to indicate that a directory
|
|
|
|
is being indexed using hashed trees. It may not be set or reset using
|
|
|
|
.BR chattr (1),
|
|
|
|
although it can be displayed by
|
|
|
|
.BR lsattr (1).
|
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
A file with the 'j' attribute has all of its data written to the ext3
|
2014-02-13 01:28:29 +08:00
|
|
|
or ext4 journal before being written to the file itself, if the filesystem
|
|
|
|
is mounted with the "data=ordered" or "data=writeback" options. When the
|
2003-03-07 01:39:55 +08:00
|
|
|
filesystem is mounted with the "data=journal" option all file data
|
2012-06-13 05:09:39 +08:00
|
|
|
is already journalled and this attribute has no effect. Only
|
|
|
|
the superuser or a process possessing the CAP_SYS_RESOURCE
|
2002-11-09 09:02:21 +08:00
|
|
|
capability can set or clear this attribute.
|
2000-12-31 21:48:12 +08:00
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
A file with the 'N' attribute set indicates that the file has data
|
|
|
|
stored inline, within the inode itself. It may not be set or reset using
|
|
|
|
.BR chattr (1),
|
|
|
|
although it can be displayed by
|
|
|
|
.BR lsattr (1).
|
|
|
|
.PP
|
|
|
|
When a file with the 's' attribute set is deleted, its blocks are zeroed
|
2005-12-31 14:04:40 +08:00
|
|
|
and written back to the disk. Note: please make sure to read the bugs
|
|
|
|
and limitations section at the end of this document.
|
1998-03-30 09:20:55 +08:00
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
When a file with the 'S' attribute set is modified,
|
1997-04-26 21:34:30 +08:00
|
|
|
the changes are written synchronously on the disk; this is equivalent to
|
2014-07-05 11:03:14 +08:00
|
|
|
the 'sync' mount option applied to a subset of the files.
|
1998-03-30 09:20:55 +08:00
|
|
|
.PP
|
2014-07-05 11:02:59 +08:00
|
|
|
A file with the 't' attribute will not have a partial block fragment at
|
|
|
|
the end of the file merged with other files (for those filesystems which
|
|
|
|
support tail-merging). This is necessary for applications such as LILO
|
|
|
|
which read the filesystem directly, and which don't understand tail-merged
|
|
|
|
files. Note: As of this writing, the ext2 or ext3 filesystems do not
|
|
|
|
(yet, except in very experimental patches) support tail-merging.
|
|
|
|
.PP
|
2012-06-13 05:09:39 +08:00
|
|
|
A directory with the 'T' attribute will be deemed to be the top of
|
2009-04-22 10:18:19 +08:00
|
|
|
directory hierarchies for the purposes of the Orlov block allocator.
|
|
|
|
This is a hint to the block allocator used by ext3 and ext4 that the
|
|
|
|
subdirectories under this directory are not related, and thus should be
|
|
|
|
spread apart for allocation purposes. For example it is a very good
|
|
|
|
idea to set the 'T' attribute on the /home directory, so that /home/john
|
|
|
|
and /home/mary are placed into separate block groups. For directories
|
|
|
|
where this attribute is not set, the Orlov block allocator will try to
|
2009-06-02 21:02:39 +08:00
|
|
|
group subdirectories closer together where possible.
|
2002-11-01 14:53:52 +08:00
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
When a file with the 'u' attribute set is deleted, its contents are
|
2005-12-31 14:04:40 +08:00
|
|
|
saved. This allows the user to ask for its undeletion. Note: please
|
|
|
|
make sure to read the bugs and limitations section at the end of this
|
|
|
|
document.
|
1998-03-30 09:20:55 +08:00
|
|
|
.PP
|
2012-06-13 05:09:39 +08:00
|
|
|
The 'X' attribute is used by the experimental compression patches to
|
2014-07-05 11:03:14 +08:00
|
|
|
indicate that the raw contents of a compressed file can be accessed
|
2012-06-13 05:09:39 +08:00
|
|
|
directly. It currently may not be set or reset using
|
2002-08-18 02:44:56 +08:00
|
|
|
.BR chattr (1),
|
|
|
|
although it can be displayed by
|
|
|
|
.BR lsattr (1).
|
|
|
|
.PP
|
2012-06-13 05:09:39 +08:00
|
|
|
The 'Z' attribute is used by the experimental compression patches to
|
|
|
|
indicate a compressed file is dirty. It may not be set or reset using
|
2002-08-18 02:44:56 +08:00
|
|
|
.BR chattr (1),
|
|
|
|
although it can be displayed by
|
|
|
|
.BR lsattr (1).
|
|
|
|
.PP
|
1997-04-26 21:21:57 +08:00
|
|
|
.SH AUTHOR
|
|
|
|
.B chattr
|
2004-02-01 09:27:36 +08:00
|
|
|
was written by Remy Card <Remy.Card@linux.org>. It is currently being
|
|
|
|
maintained by Theodore Ts'o <tytso@alum.mit.edu>.
|
1997-04-26 21:21:57 +08:00
|
|
|
.SH BUGS AND LIMITATIONS
|
2014-07-05 11:03:14 +08:00
|
|
|
The 'c', 's', and 'u' attributes are not honored
|
2013-05-13 21:10:16 +08:00
|
|
|
by the ext2, ext3, and ext4 filesystems as implemented in the current
|
|
|
|
mainline Linux kernels.
|
1997-04-26 21:21:57 +08:00
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
The 'j' option is only useful if the filesystem is mounted as ext3 or ext4.
|
2002-06-16 06:58:39 +08:00
|
|
|
.PP
|
2014-07-05 11:03:14 +08:00
|
|
|
The 'D' option is only useful on Linux kernel 2.5.19 and later.
|
1997-04-26 21:21:57 +08:00
|
|
|
.SH AVAILABILITY
|
|
|
|
.B chattr
|
2001-05-12 23:46:21 +08:00
|
|
|
is part of the e2fsprogs package and is available from
|
|
|
|
http://e2fsprogs.sourceforge.net.
|
1997-04-26 21:21:57 +08:00
|
|
|
.SH SEE ALSO
|
2014-07-05 11:03:14 +08:00
|
|
|
.BR lsattr (1),
|
|
|
|
.BR btrfs (5),
|
|
|
|
.BR ext4 (5),
|
|
|
|
.BR xfs (5).
|