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". Two questions: - Is there a way to tell is a given directory is indexed or not? - Is there a better way to index the root fs than to boot off a live CD? Best, Norbert P.S.: Please CC me as I'm not subscribed to the list. --nk
On Thu, August 3, 2006 14:09, Norbert Kiesel wrote:> - Is there a way to tell is a given directory is indexed or not?I think the "htree_dump" command in debugfs(8) should display dir_index information, although I could not find really much documentation, it's only mentioned in the manpage.> - Is there a better way to index the root fs than to boot off a live > CD?read-only mounting in single-user mode comes to mind, but then again I don't know if "e2fsck -D" is a safe thing to do with an ro-mounted volume. you could try it beforehand with a dummy-volume: # dd if=/dev/zero of=test.img bs=1M count=500 # losetup /dev/loop0 test.img # mkfs.ext3 /dev/loop0 # mount /dev/loop0 /mnt # copy-some-data-to-/mnt # mount -o remount,ro /mnt # e2fsck -D /dev/loop0 # mount -o remount,rw /mnt ....and verify that all data is correct (diff(1)!) (untested, keep you backups handy ;)) -- BOFH excuse #442: Trojan horse ran out of hay
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