$ chattr --version chattr 1.18.7, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
$ lsattr [...] ----------- - - doc ----------- - - weka ----------- - - weka-src [...]
$chattr -R +c doc [...] --c-------- 32 gzip9 doc [...]
$ cd doc $ lsattr --c----B--- 32 gzip9 AllNames.html --c-------- 32 gzip9 Package-weka.associations.html
DESCRIPTION
chattr changes the file attributes on a Linux second extended file system.
The format of a symbolic mode is +-=[ABDESXacdisu].
(c) compressed
The `B' (file contains compressed clusters) and `D' (file has some clusters needing compression) flags are accepted but ignored. These flags cannot be changed from user space.
OPTIONS
-R Recursively change attributes of directories and their con-
tents. Symbolic links encountered during recursive directory
traversals are ignored.-V Be verbose with chattr's output and print the program version.
-m compression_method
Set the algorithm used for compression. Currently, the only
supported algorithms are `bzip2', `lzv1', `lzrw3a' and
`gzip1', `gzip2', ..., `gzip9' where the number is equivalent
to the compression level used for gzip.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 is followed by an attempt to compress the data written.
Directories can also be marked with the `c' attribute; in such a case, nothing is compressed, but any newly created file in the direc- tory will automatically be marked with the `c' attribute. Similarly, a directory can be given an algorithm name and/or cluster size, so that newly created files will use this algorithm / cluster size. New files in the directory will only inherit the flags if they get a new inode, not if they are simply given a new link in that directory (e.g. with `mv' or `ln').
*References*: please refer to cmd:e2compr topic in disk tools section in TuGnrl.doc for general info.
Generally, not going to use it for the following reasons:
`e2compress' is just another way of achieving `chattr +c' (or `chattr -c). Unlike `chattr +c', `e2compress' creates a new file for the compressed file, deleting the original once the compression has been verified. The advantage of this is that the newly created file needn't be fragmented. (You may also consider it an advantage that the transformation is verified.) It should also be safer in the case that your machine is switched off (etc.) part way through compression (because the original file should still be on on the hard disk). Another difference from `chattr +c' is that the compression occurs in user space rather than kernel space. The disadvantage is that you need to have space on your hard disk for both to exist simultaneously.
Problem: Kernel patches is only for linux-2.1.
e2compr patch for kernel 2.1.93 and above. Yes, this really is the most recent kernel I've released a 0.3 patch against. So far no-one's complained;
I think most/all people who use 2.1 (or 2.2) kernels have switched to e2compr-0.4. If do want to use e2compr-0.3.x with Linux 2.2, then say so, though you should consider switching to e2compr-0.4.x, which fixes a couple of bugs.