|
|
ec15cf |
commit 272258e1dffe8afb6c9d0b0ba5edc119dbf9f52a
|
|
|
ec15cf |
Author: Eric Sandeen <sandeen@redhat.com>
|
|
|
ec15cf |
Date: Fri Jul 4 23:03:14 2014 -0400
|
|
|
ec15cf |
|
|
|
ec15cf |
e2fsprogs: revise and extend chattr(1) and chattr usage()
|
|
|
ec15cf |
|
|
|
ec15cf |
The chattr(1) manpage and chattr usage() output were missing some flags.
|
|
|
ec15cf |
|
|
|
ec15cf |
Add those, and make some other minor cosmetic fixes.
|
|
|
ec15cf |
|
|
|
ec15cf |
(I've left out the 'B' (EXT2_COMPRBLK_FL) flag, because
|
|
|
ec15cf |
it's not actually used anywhere, and I can't figure out
|
|
|
ec15cf |
how it differs from 'c' (EXT2_COMPR_FL))
|
|
|
ec15cf |
|
|
|
ec15cf |
Also, because the matrix of filesystems & flags is quite large,
|
|
|
ec15cf |
refer to filesystem-specific manpages for detailed discussion
|
|
|
ec15cf |
of flags supported by those filesystems, rather than trying to
|
|
|
ec15cf |
cover it all in this manpage. I'll send those manpage
|
|
|
ec15cf |
updates to the appropriate lists a bit later.
|
|
|
ec15cf |
|
|
|
ec15cf |
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
|
|
ec15cf |
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
|
ec15cf |
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
|
|
|
ec15cf |
|
|
|
ec15cf |
diff --git a/misc/chattr.1.in b/misc/chattr.1.in
|
|
|
ec15cf |
index ce426e8..23b6938 100644
|
|
|
ec15cf |
--- a/misc/chattr.1.in
|
|
|
ec15cf |
+++ b/misc/chattr.1.in
|
|
|
ec15cf |
@@ -21,11 +21,11 @@ changes the file attributes on a Linux file system.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
The format of a symbolic mode is +-=[aAcCdDeijsStTu].
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-The operator `+' causes the selected attributes to be added to the
|
|
|
ec15cf |
-existing attributes of the files; `-' causes them to be removed; and
|
|
|
ec15cf |
-`=' causes them to be the only attributes that the files have.
|
|
|
ec15cf |
+The operator '+' causes the selected attributes to be added to the
|
|
|
ec15cf |
+existing attributes of the files; '-' causes them to be removed; and
|
|
|
ec15cf |
+'=' causes them to be the only attributes that the files have.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-The letters `aAcCdDeijsStTu' select the new attributes for the files:
|
|
|
ec15cf |
+The letters 'aAcCdDeijsStTu' select the new attributes for the files:
|
|
|
ec15cf |
append only (a),
|
|
|
ec15cf |
no atime updates (A),
|
|
|
ec15cf |
compressed (c),
|
|
|
ec15cf |
@@ -47,8 +47,17 @@ but not modified by chattr:
|
|
|
ec15cf |
compression error (E),
|
|
|
ec15cf |
huge file (h),
|
|
|
ec15cf |
indexed directory (I),
|
|
|
ec15cf |
+inline data (N),
|
|
|
ec15cf |
compression raw access (X),
|
|
|
ec15cf |
and compressed dirty file (Z).
|
|
|
ec15cf |
+.PP
|
|
|
ec15cf |
+Not all flags are supported or utilized by all filesystems; refer to
|
|
|
ec15cf |
+filesystem-specific man pages such as
|
|
|
ec15cf |
+.BR btrfs (5),
|
|
|
ec15cf |
+.BR ext4 (5),
|
|
|
ec15cf |
+and
|
|
|
ec15cf |
+.BR xfs (5)
|
|
|
ec15cf |
+for more filesystem-specific details.
|
|
|
ec15cf |
.SH OPTIONS
|
|
|
ec15cf |
.TP
|
|
|
ec15cf |
.B \-R
|
|
|
ec15cf |
@@ -63,7 +72,7 @@ Suppress most error messages.
|
|
|
ec15cf |
.BI \-v " version"
|
|
|
ec15cf |
Set the file's version/generation number.
|
|
|
ec15cf |
.SH ATTRIBUTES
|
|
|
ec15cf |
-A file with the `a' attribute set can only be open in append mode for writing.
|
|
|
ec15cf |
+A file with the 'a' attribute set can only be open in append mode for writing.
|
|
|
ec15cf |
Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE
|
|
|
ec15cf |
capability can set or clear this attribute.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
@@ -71,7 +80,7 @@ When a file with the 'A' attribute set is accessed, its atime record is
|
|
|
ec15cf |
not modified. This avoids a certain amount of disk I/O for laptop
|
|
|
ec15cf |
systems.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-A file with the `c' attribute set is automatically compressed on the disk
|
|
|
ec15cf |
+A file with the 'c' attribute set is automatically compressed on the disk
|
|
|
ec15cf |
by the kernel. A read from this file returns uncompressed data. A write to
|
|
|
ec15cf |
this file compresses data before storing them on the disk. Note: please
|
|
|
ec15cf |
make sure to read the bugs and limitations section at the end of this
|
|
|
ec15cf |
@@ -86,13 +95,13 @@ be fully stable. If the 'C' flag is set on a directory, it will have no
|
|
|
ec15cf |
effect on the directory, but new files created in that directory will
|
|
|
ec15cf |
the No_COW attribute.)
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-A file with the `d' attribute set is not candidate for backup when the
|
|
|
ec15cf |
+A file with the 'd' attribute set is not candidate for backup when the
|
|
|
ec15cf |
.BR dump (8)
|
|
|
ec15cf |
program is run.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-When a directory with the `D' attribute set is modified,
|
|
|
ec15cf |
+When a directory with the 'D' attribute set is modified,
|
|
|
ec15cf |
the changes are written synchronously on the disk; this is equivalent to
|
|
|
ec15cf |
-the `dirsync' mount option applied to a subset of the files.
|
|
|
ec15cf |
+the 'dirsync' mount option applied to a subset of the files.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
The 'e' attribute indicates that the file is using extents for mapping
|
|
|
ec15cf |
the blocks on disk. It may not be removed using
|
|
|
ec15cf |
@@ -112,7 +121,7 @@ is (or at one time was) larger than 2TB. It may not be set or reset using
|
|
|
ec15cf |
although it can be displayed by
|
|
|
ec15cf |
.BR lsattr (1).
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-A file with the `i' attribute cannot be modified: it cannot be deleted or
|
|
|
ec15cf |
+A file with the 'i' attribute cannot be modified: it cannot be deleted or
|
|
|
ec15cf |
renamed, no link can be created to this file and no data can be written
|
|
|
ec15cf |
to the file. Only the superuser or a process possessing the
|
|
|
ec15cf |
CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
|
|
|
ec15cf |
@@ -123,7 +132,7 @@ is being indexed using hashed trees. It may not be set or reset using
|
|
|
ec15cf |
although it can be displayed by
|
|
|
ec15cf |
.BR lsattr (1).
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-A file with the `j' attribute has all of its data written to the ext3
|
|
|
ec15cf |
+A file with the 'j' attribute has all of its data written to the ext3
|
|
|
ec15cf |
or ext4 journal before being written to the file itself, if the filesystem
|
|
|
ec15cf |
is mounted with the "data=ordered" or "data=writeback" options. When the
|
|
|
ec15cf |
filesystem is mounted with the "data=journal" option all file data
|
|
|
ec15cf |
@@ -131,13 +140,19 @@ is already journalled and this attribute has no effect. Only
|
|
|
ec15cf |
the superuser or a process possessing the CAP_SYS_RESOURCE
|
|
|
ec15cf |
capability can set or clear this attribute.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-When a file with the `s' attribute set is deleted, its blocks are zeroed
|
|
|
ec15cf |
+A file with the 'N' attribute set indicates that the file has data
|
|
|
ec15cf |
+stored inline, within the inode itself. It may not be set or reset using
|
|
|
ec15cf |
+.BR chattr (1),
|
|
|
ec15cf |
+although it can be displayed by
|
|
|
ec15cf |
+.BR lsattr (1).
|
|
|
ec15cf |
+.PP
|
|
|
ec15cf |
+When a file with the 's' attribute set is deleted, its blocks are zeroed
|
|
|
ec15cf |
and written back to the disk. Note: please make sure to read the bugs
|
|
|
ec15cf |
and limitations section at the end of this document.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-When a file with the `S' attribute set is modified,
|
|
|
ec15cf |
+When a file with the 'S' attribute set is modified,
|
|
|
ec15cf |
the changes are written synchronously on the disk; this is equivalent to
|
|
|
ec15cf |
-the `sync' mount option applied to a subset of the files.
|
|
|
ec15cf |
+the 'sync' mount option applied to a subset of the files.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
A file with the 't' attribute will not have a partial block fragment at
|
|
|
ec15cf |
the end of the file merged with other files (for those filesystems which
|
|
|
ec15cf |
@@ -156,13 +171,13 @@ and /home/mary are placed into separate block groups. For directories
|
|
|
ec15cf |
where this attribute is not set, the Orlov block allocator will try to
|
|
|
ec15cf |
group subdirectories closer together where possible.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-When a file with the `u' attribute set is deleted, its contents are
|
|
|
ec15cf |
+When a file with the 'u' attribute set is deleted, its contents are
|
|
|
ec15cf |
saved. This allows the user to ask for its undeletion. Note: please
|
|
|
ec15cf |
make sure to read the bugs and limitations section at the end of this
|
|
|
ec15cf |
document.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
The 'X' attribute is used by the experimental compression patches to
|
|
|
ec15cf |
-indicate that a raw contents of a compressed file can be accessed
|
|
|
ec15cf |
+indicate that the raw contents of a compressed file can be accessed
|
|
|
ec15cf |
directly. It currently may not be set or reset using
|
|
|
ec15cf |
.BR chattr (1),
|
|
|
ec15cf |
although it can be displayed by
|
|
|
ec15cf |
@@ -179,16 +194,19 @@ although it can be displayed by
|
|
|
ec15cf |
was written by Remy Card <Remy.Card@linux.org>. It is currently being
|
|
|
ec15cf |
maintained by Theodore Ts'o <tytso@alum.mit.edu>.
|
|
|
ec15cf |
.SH BUGS AND LIMITATIONS
|
|
|
ec15cf |
-The `c', 's', and `u' attributes are not honored
|
|
|
ec15cf |
+The 'c', 's', and 'u' attributes are not honored
|
|
|
ec15cf |
by the ext2, ext3, and ext4 filesystems as implemented in the current
|
|
|
ec15cf |
mainline Linux kernels.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-The `j' option is only useful if the filesystem is mounted as ext3 or ext4.
|
|
|
ec15cf |
+The 'j' option is only useful if the filesystem is mounted as ext3 or ext4.
|
|
|
ec15cf |
.PP
|
|
|
ec15cf |
-The `D' option is only useful on Linux kernel 2.5.19 and later.
|
|
|
ec15cf |
+The 'D' option is only useful on Linux kernel 2.5.19 and later.
|
|
|
ec15cf |
.SH AVAILABILITY
|
|
|
ec15cf |
.B chattr
|
|
|
ec15cf |
is part of the e2fsprogs package and is available from
|
|
|
ec15cf |
http://e2fsprogs.sourceforge.net.
|
|
|
ec15cf |
.SH SEE ALSO
|
|
|
ec15cf |
-.BR lsattr (1)
|
|
|
ec15cf |
+.BR lsattr (1),
|
|
|
ec15cf |
+.BR btrfs (5),
|
|
|
ec15cf |
+.BR ext4 (5),
|
|
|
ec15cf |
+.BR xfs (5).
|
|
|
ec15cf |
diff --git a/misc/chattr.c b/misc/chattr.c
|
|
|
ec15cf |
index d5a6a61..f130108 100644
|
|
|
ec15cf |
--- a/misc/chattr.c
|
|
|
ec15cf |
+++ b/misc/chattr.c
|
|
|
ec15cf |
@@ -83,7 +83,7 @@ static unsigned long sf;
|
|
|
ec15cf |
static void usage(void)
|
|
|
ec15cf |
{
|
|
|
ec15cf |
fprintf(stderr,
|
|
|
ec15cf |
- _("Usage: %s [-RVf] [-+=aAcCdDeijsSu] [-v version] files...\n"),
|
|
|
ec15cf |
+ _("Usage: %s [-RVf] [-+=aAcCdDeijsStTu] [-v version] files...\n"),
|
|
|
ec15cf |
program_name);
|
|
|
ec15cf |
exit(1);
|
|
|
ec15cf |
}
|