ext4 and extremely slow filesystem traversal

Theodore Ts'o tytso at mit.edu
Thu Mar 14 01:05:51 UTC 2013


On Wed, Mar 13, 2013 at 09:49:20PM +0100, Vincent Caron wrote:
> On 13/03/2013 21:33, Theodore Ts'o wrote:
> > Wow.  You have more directories than regular files!  Given that there
> > are no hard links, that implies that you have at least 2,079,271
> > directories which are ***empty***.
> 
>   Awful, isn't it ? I knew directories were abused, but didn't know that
> 'e2fsck -v' would display the exact figures (since I never waited 5+
> hours to scan the whole filesystem). Nice to know.

Just as a note, e2fsck -v can sometimes get this information much more
quickly than other alternatives, since it can scan the file system in
inode order, instead of the essentially random order.

Just as a side, if you just want to get a rough count of the number of
directories, you can get that by grabbing the information out of
dumpe2fs.

Group 624: (Blocks 20447232-20479999) [ITABLE_ZEROED]
  Checksum 0xd3f5, unused inodes 4821
  Block bitmap at 20447232 (+0), Inode bitmap at 20447248 (+16)
  Inode table at 20447264-20447775 (+32)
  24103 free blocks, 4821 free inodes, 435 directories, 4821 unused inodes
                                       ^^^^^^^^^^^^^^^
  Free blocks: 20455889, 20455898-20479999
  Free inodes: 5115180-5120000

Dumpe2fs doesn't actually sum the number of directories, and you won't
be able to differentiate the number of files that are regular files versus
symlinks, device nodes, etc., but if you just want to get the number
of directories, you can get this number by getting the information out
of dumpe2fs without having to wait for e2fsck to complete.  You can
even do this with a mounted file system, but the number will of course
not necessarily be completely accurate if you do that.

(You can get the number of inodes in use by subtracting the number of
free inodes from the number of inodes in the file system.  If you then
subtract the number of directories, then you can get the number of
non-directory inodes versus directory inodes.)

    		   	      	       	      - Ted




More information about the Ext3-users mailing list