CHATTR(1) CHATTR(1)
名前
chattr - Linux 第 2 拡張ファイルシステム (ext2fs) 上にあるファイルの属
性 (attribute) を変更する
書式
chattr [ -RV ] [ -v version ] [ mode ] files...
説明
chattr は Linux 第 2 拡張ファイルシステム (ext2fs) 上にあるファイルの属
性 (attribute) を変更する。
mode の記法フォーマットは +-=[ASacDdIijsTtu] である。
+ オペレータを使用すると、選択した属性がファイルに付加される。 - オペレ
ータを使用すると解除される。 = オペレータを使用すると、ファイルは指定し
た属性だけを持つことになる。
「acdijsuADST 」は指定できる属性である。 (a) 追加のみ許可 (append only)
、(c) 圧縮 (compressed)、 (d) ダンプしない (no dump)、(i) 変 更 不 可
(immutable) 、 (j) データのジャーナリング (data journalling)、 (s) 安全
な削除 (secure deletion)、(t) 末尾マージをしない (no tail-merging) 、
(u) 復活可能 (undeletable)、 (A) atime を更新しない、 (D) ディレクトリ
の同期更新 (synchronous directory updates)、 (S) 同期更新 (synchronous
updates)、 (T) ディレクトリ階層のトップ。
オプション
-R 再帰的にディレクトリやその中身の属性を変更する。ディレクトリを順
番に訪れている途中でシンボリックリンクに出会った場合は、これを無
視する。
-V 属性の変更を詳細に表示する。
-v version
ファイルシステムのバージョン/世代を設定する。
属性
‘A’ 属性が設定されているファイルは、アクセスされても atime レコードが変
更されない。これはラップトップシステムのディスク I/O をある程度軽減する
。
‘a’ 属性が設定されているファイルは、書き込みの際に追加モードでしかオー
プンできない。スーパーユーザーまたは CAP_LINUX_IMMUTABLE ケーパビリティ
(capability) を持つプロセスだけが、この属性を設定・解除できる。
‘c’ 属性が設定されているファイルは、ディスク上に置かれるときカーネルに
よって自動的に圧縮される。このファイルを読み出すと、伸長されたデータ が
返 ってくる。このファイルに書き込むと、ディスク上に保存する前にデータが
圧縮される。注意: このドキュメントの最後にある「バグと制限」のセクシ ョ
ンを読んで確かめてほしい。
‘D’ 属性が設定されているディレクトリは、変更されると同時にディスクにも
その内容が書き込まれる。これは ‘dirsync’ マウントオプションを、それらの
ファイルだけに適用するのと同じことである。
‘d’ 属性が設定されているファイルは、 dump(8) プログラムを起動した際に
バックアップされない。
‘E’ 属性は実験的な圧縮パッチが用いるもので、圧縮ファイルに圧縮エラー が
あることを示す。この属性は chattr(1) によって設定したり解除したりするこ
とはできないが、 lsattr(1) を用いて表示させることはできる。
‘I’ 属性は htree コードによって用いられ、ディレクトリがハッシュツリーを
使って索引を付けられることを示す。この属性は chattr(1) によって設定した
り解除したりすることはできないが、 lsattr(1) を用いて表示させることはで
きる。
‘i’ 属性が設定されているファイルは、変更することができない。すなわち、
削除、名前の変更、このファイルを指すリンクの作成、このファイルに対す る
デ ー タ の 書 き 込 み が 禁 止 さ れ る 。 ス ー パ ー ユーザーまたは
CAP_LINUX_IMMUTABLE ケーパビリティを持つプロセスだけが、この属性を設 定
・解除できる。
‘j’ 属性が設定されているファイルは、ファイルシステムが "data=ordered"
または "data=writeback" オプションでマウントされている場合、ファイル そ
の ものに書き出される前に、 ext3 のジャーナルにデータが書き出される。フ
ァイルシステムが "data=journal" オプションでマウントされている場合、 全
て のファイルデータは既にジャーナルに記録されているので、この属性は何も
影響しない。スーパーユーザーまたは CAP_SYS_RESOURCE ケーパビリティを 持
つプロセスだけが、この属性を設定・解除できる。
‘s’ 属性が設定されているファイルが削除されると、割り当てられていたブロ
ックの中身が 0 にされ、ディスクに書き戻される。注意: このドキュメントの
最後にある「バグと制限」のセクションを読んで確かめてほしい。
‘S’ 属性が設定されているファイルが変更されると、変更は同期的にディスク
に書き込まれる (すなわち変更が直ちにディスク上に反映される) 。 こ れ は
mount オプションの ‘sync’ をそれらのファイルだけに適用するのと同じこと
である。
‘T’ 属性が設定されているディレクトリは、 (Linux 2.5.46 以降のシステムで
使 われる) Orlov ブロックアロケータのためのディレクトリ階層のトップとし
て扱われる。
‘t’ 属性が設定されているファイルは、そのファイルが他のファイルとマー ジ
さ れ た ときに部分的ブロックのフラグメントを末尾に作らない (末尾マージ
(tail-merging) をサポートしているファイルシステムの場合)。これ は LILO
の ような、ファイルシステムを直接読みにいき、かつ末尾マージされたファイ
ルのことを理解しないようなアプリケーションに対して必要となる。注: こ の
man ページを書いている時点で、ext2 と ext3 ファイルシステムは (まだ非常
に実験的なパッチ以外では) 末尾マージをサポートしていない。
‘u’ 属性が設定されているファイルを削除すると、その内容は保護される。 こ
れ により、ユーザがファイルを復活させることが可能になる。注意: このドキ
ュメントの最後にある「バグと制限」のセクションを読んで確かめてほしい。
‘X’ 属性は実験的な圧縮パッチによって用いられ、圧縮ファイルの内容が圧 縮
状 態 の ま ま 直接アクセス可能であることを示す。この属性は現在のところ
chattr(1) によって設定したり解除したりすることはできないが、 lsattr(1)
を用いて表示させることはできる。
‘Z’ 属性は実験的な圧縮パッチによって用いられ、圧縮ファイルが汚染されて
いる (dirty) ことを示す。この属性は chattr(1) によって設定したり解除 し
たりすることはできないが、 lsattr(1) を用いて表示させることはできる。
著者
chattr は、Remy Card
CHATTR(1) CHATTR(1)
NAME
chattr - change file attributes on a Linux file system
SYNOPSIS
chattr [ -RVf ] [ -v version ] [ mode ] files...
DESCRIPTION
chattr changes the file attributes on a Linux file system.
The format of a symbolic mode is +-=[acdeijstuADST].
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 ‘acdeijstuADST’ select the new attributes for the files:
append only (a), compressed (c), no dump (d), extent format (e),
immutable (i), data journalling (j), secure deletion (s), no tail-merg-
ing (t), undeletable (u), no atime updates (A), synchronous directory
updates (D), synchronous updates (S), and top of directory hierarchy
(T).
The following attributes are read-only, and may be listed by lsattr(1)
but not modified by chattr: huge file (h), compression error (E),
indexed directory (I), compression raw access (X), and compressed dirty
file (Z).
OPTIONS
-R Recursively change attributes of directories and their contents.
-V Be verbose with chattr’s output and print the program version.
-f Suppress most error messages.
-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 sys-
tems.
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.
Note: please make sure to read the bugs and limitations section at the
end of this document.
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 ’e’ attribute indicates that the file is using extents for mapping
the blocks on disk. It may not be removed using chattr(1).
The ’I’ attribute is used by the htree code to indicate that a direc-
tory is being indexed using hashed trees. It may not be set or reset
using chattr(1), although it can be displayed by lsattr(1).
The ’h’ attribute indicates the file is storing its blocks in units of
the 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 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 supe-
ruser 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. Note: please make sure to read
the bugs and limitations section at the end of this document.
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.
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 group subdirectories closer together where possible.
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 filesys-
tems 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. Note: please
make sure to read the bugs and limitations section at the end of this
document.
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
コロナウイルスの日ごとの感染者数・死者数をグラフ化してみました。どの国が増加傾向にあり、どの国が終息に向かっているかを視覚化しています。
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa