Disk defragmenter in Linux
ianburrell at gmail.com
Fri Dec 23 18:36:41 UTC 2005
Tony Nelson <tonynelson <at> georgeanelson.com> writes:
> The opinion that EXT2 doesn't need defragmenting is based on only a
> filesystem-level view of the problem, and doesn't consider data read and
> write performance. EXT2 does make an effort to keep data only a short seek
> away ("clustered"). With this clustering, the filesystem operations of
> adding, removing, extending, and shortening files are not much affected by
> With EXT3 (journalling), which always writes data to a new place, updates
> the filesystem info, and then frees the old data (roughly speaking),
> fragmentation is a way of life, and there isn't much to be done about it.
> Clustering helps by keeping the seeks relatively short, if there is space
> When you have only 2% free, it's just about certain that the free space is
> a long way away from the rest of the data in a file. Just deleting to get
> 20% free would probably have fixed your problem.
You are confused about how journalling works. The new blocks are written to the
journal, then when the change is comitted, the blocks are written to their
normal place and the journal reused. For a recovery, the journal is replayed,
writing changes to the normal location on the disk. Since the journal file is
usually already allocated, the new blocks are pretty much in the same place as
they would have been without it. Most people run ext3 in the default mode where
only the metadata is journalled.
Log-structured filesystems are where the entire filesystem is the journal. The
changes are written to the end and the old blocks left in the place. This
results in better write performance but bad fragmentation.
More information about the fedora-list