chattr

 

 

 


chattr

 

Install

apt-get install e2fsprogs

yum install e2fsprogs

Usage

chattr opts file

opts

+-=[ASacDdIijsTtu]

解釋

i        # cannot be modified (內容 / permission)

# Only the superuser or  a  process  possessing  the  CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

rm: remove regular empty file `testfile'? y

rm: cannot remove `testfile': Operation not permitted

a         # append only

c         # compressed ( by  the  kernel )

s         # secure deletion

u         # undeletable

A         # no atime updates

D         # synchronous directory updates (equivalent  to the `dirsync' mount option applied to a subset of the files.)

S         # synchronous updates (equivalent to the `sync' mount option applied to a subset of the files)

'T' attribute

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.

'e' attribute

indicates that the file is using extents for mapping the blocks on disk. (not be removed using chattr)

 


lsattr

lsattr testfile

----i--------e-- testfile

 

 

Creative Commons license icon Creative Commons license icon