Go to the first, previous, next, last section, table of contents.

It seems to me that files will be fragmented a lot.

Antoine: Then you are right.... Instead of freeing unneeded blocks, we could free the complete cluster and then reallocate the really needed blocks. Preliminary tests showed me that it does not improve the speed if the machine is not highly loaded, but it certainly would if it were. It also certainly depends on the speed of your disk.

If this is a problem, you can use e2compress to compress your files instead of chattr. This will of course be useful if the file is used only in read mode, but even if it is sometimes written it will probably reduce the fragmentation.

See section Can I still use a defragmenter? for comments on using a defragmenter.

pjm: Fragmentation isn't as bad as one might first think, because the majority of files on a typical Linux filesystem are smaller than one cluster. (Whether or not most disk space is occupied by single-cluster files, is another question; it's harder for me to check that.) The blocks of a compressed cluster are the first few blocks allocated to that cluster when uncompressed, which are usually contiguous. Significant extra fragmentation only occurs with large files compressed by the kernel (rather than by e2compress).

Go to the first, previous, next, last section, table of contents.