how can I tell if a directory is using dir_index?

Theodore Tso tytso at mit.edu
Fri Aug 18 15:30:15 UTC 2006


On Thu, Aug 03, 2006 at 03:09:17PM +0200, Norbert Kiesel wrote:
> Hi,
> 
> I enabled dir_index on a filesystem and dumpe2fs -h also reports this.
> My understanding is that this will be used for newly created directories
> and that old directories can be indexed using "fsck.ext2 -D".

More properly, directories that grow beyond a single filesystem block
(normally 4k) will be indexed once dir_index is enabled.  (A directory
with a single block is identical to a tree with a single leaf block
and nothing else.)

And to index directories greater than one block, you need to use the
e2fsck/fsck.ext2 options "-fD".

> Two questions:
>  - Is there a way to tell is a given directory is indexed or not? 

Use the lsattr command and see if the 'I' flag is set, i.e:

% lsattr -d ~/isync/mit/cur
--------------I-- /home/tytso/isync/mit/cur


>  - Is there a better way to index the root fs than to boot off a live
> CD?

Most of the time the root directory is less than a single block, which
means it wouldn't be indexed in any case, and if it grew beyond 1
block, it would automatically be indexed.  

						- Ted




More information about the Ext3-users mailing list