chattr 中文man页面

系统
chattr 修改文件在Linux第二扩展文件系统(E2fs)上的特有属性

NAME(名称)

chattr - 修改文件在Linux第二扩展文件系统(E2fs)上的特有属性  

SYNOPSIS(总览)

chattr [ -RV ] [ -v version ] [ mode ] files...  

DESCRIPTION(描述)

chattr 修改文件在Linux第二扩展文件系统(E2fs)上的特有属性

符号模式有+-=[ASacdisu]几种格式.

操作符`+'用来在文件已有属性的基础上增加选定的属性; `-'用来去掉文件上的选定的属性;而`='用来指定该文件的唯一属性.

字符`ASacdisu'用作文件新属性的选项: 不更新atime(A),同步更新(S),只能添加(a), 压缩(c),不可变(i),不可转移(d),删除保护(s)以及不可删除(u).  

OPTIONS(选项)

-R
递归地修改目录以及其下内容的属性. 如果在递归目录时遇到了符号链接,遍历将跳过.
-V
详尽地给出chattr的输出信息并打印出程序的版本.
-v version
设置文件系统的版本.

ATTRIBUTES(属性)

当修改设置了'A'属性的文件时,它的atime记录不会改变. 这可以在笔记本电脑系统中避免某些磁盘I/O处理.

设置了`a'属性的文件只能在添加模式下打开用于写入. 只有超级用户可以设置或清除该属性.

设置了`c'属性的文件在磁盘上由内核自动进行压缩处理. 从该文件读取时返回的是未压缩的数据. 对该文件的一次写入会在保存它们到磁盘之前进行数据压缩.

设置了`d'属性的文件不能对其运行 dump(8) 程序进行备份.

设置了`i'属性的文件不能进行修改:你既不能删除它, 也不能给它重新命名,你不能对该文件创建链接, 而且也不能对该文件写入任何数据. 只有超级用户可以设置或清除该属性.

当删除设置了`s'属性的文件时,将对其数据块清零并写回到磁盘上.

当修改设置了`S'属性的文件时, 修改会同步写入到磁盘上;这与应用到文件子系统上的`sync'挂载选项有相同的效果.

当删除设置了`u'属性的文件时, 将会保存其内容. 这使得用户可以请求恢复被删除的文件.

AUTHOR(作者)

chattr 的作者为Remy Card <card@masi.ibp.fr>, 他是ext2 fs的开发和维护者.  

BUGS AND LIMITATIONS(BUGS和局限性)

对于ext2 fs 0.5a来说,`c'和`u'属性是不被内核代码所承认的. 对于Linux 2.0内核而言,'A'属性也是不被内核代码所支持的. (noatime代码仍在测试中.)

这些属性将在未来的ext2 fs版本中实现.  

AVAILABILITY(怎样获取)

chattr 是e2fsprogs包的一部分, 你可以通过对tsx-11.mit.edu的匿名ftp访问在 /pub/linux/packages/ext2fs下找到它.  

SEE ALSO(另见)

lsattr(1)  

#p#

NAME

chattr - change file attributes on a Linux second extended file system  

SYNOPSIS

chattr [ -RV ] [ -v version ] [ mode ] files...  

DESCRIPTION

chattr changes the file attributes on a Linux second extended file system.

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 the new attributes for the files: append only (a), compressed (c), no dump (d), immutable (i), data journalling (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
Set the file's version/generation number.

ATTRIBUTES

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.

A file with the `a' attribute set can only be open in append mode for writing. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

A file with the `c' attribute set is automatically compressed on the disk by the kernel. A read from this file returns uncompressed data. A write to this file compresses data before storing them on the disk.

When a directory with the `D' attribute set is modified, the changes are written synchronously on the disk; this is equivalent to the `dirsync' mount option applied to a subset of the files.

A file with the `d' attribute set 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 has a compression error. It may not be set or reset using chattr(1), although it can be displayed by lsattr(1).

The 'I' attribute is used by the htree code to indicate that a directory is behind indexed using hashed trees. It may not be set or reset using chattr(1), although it can be displayed by lsattr(1).

A file with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

A file with the `j' attribute has all of its data written to the ext3 journal before being written to the file itself, if the filesystem is mounted with the "data=ordered" or "data=writeback" options. When the filesystem is mounted with the "data=journal" option all file data is already journalled and this attribute has no effect. Only the superuser or a process possessing the CAP_SYS_RESOURCE capability can set or clear this attribute.

When a file with the `s' attribute set is deleted, its blocks are zeroed and written back to the disk.

When a file with the `S' attribute set is modified, the changes are written synchronously on the disk; this is equivalent to the `sync' mount 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 on systems with Linux 2.5.46 or later).

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.

When a file with the `u' attribute set 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 contents of a compressed file can be accessed directly. It currently may not be set or reset 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 is dirty. It may not be set or reset 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 the current mainline Linux kernels. These attributes may be implemented in future versions ext2 and ext3.

The `j' option is only useful if 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)

责任编辑:韩亚珊 来源: 互联网
相关推荐

2011-08-15 10:21:09

man中文man

2011-08-24 16:48:36

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-11 15:03:21

ACCESS中文man

2011-08-16 10:59:16

pwconv中文man

2011-08-19 18:30:52

ipc中文man

2011-08-25 17:18:07

putc中文man

2011-08-15 13:53:19

stat中文man

2011-08-25 15:24:31

execlp中文man

2011-08-15 18:06:07

restore中文man

2011-08-15 15:45:04

xpdf中文man

2011-08-24 17:06:42

NOTIFY中文man

2011-08-15 14:42:28

uname中文man

2011-08-15 11:30:37

pwd中文man

2011-08-23 14:24:42

ping中文man

2011-08-15 11:01:45

2011-08-25 17:15:16

printf中文man

2011-08-25 16:44:46

ftrylockfil中文man

2011-08-23 17:24:11

userdel中文man
点赞
收藏

51CTO技术栈公众号