Subject: Re: Defragmenting a NetBSD drive
To: None <>
From: Guenther Grau <>
List: netbsd-ports
Date: 09/15/1999 20:31:55

>   | The kernel already collects unused blocks of directories.  Given a
>   | directory that takes up 2 512 byte blocks, if you remove enough directory
>   | entries to cause the required space to drop to 1 512 byte block, as soon as
>   | you create another directory entry, the compaction occurs.

Hmm, why does the compaction happen creation time, not when a
directory is deleted?

> Not quite.
> That happens, if, and only if, the last block(s) of the directory are
> empty - there's nothing which will move the entries around in a
> directory so that the empty blocks appear at the end - nor to move directory
> entries from one block to another so as to make empty blocks.

Why are directory entries not compressed when a directory gets
deleted? The fs could move the entries around, couldn't it?
I guess this is not done for performance reasons, right?
Then a defragmentation tool would be nice which could be
run on a nightly/weekly basis to compress large directories.