[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: reading an empty directory after reboot is very slow

On Tue, Apr 14, 2015, at 14:52, Doug wrote:

> >>> Removing files from the directory does not change directory's inode
> >>> size. If using ext4, at least.

> What is the best way of solving this? Since the directory is empty, can you
> just do an rmdir dirname ? Now if there are one or two files in it, will it
> shrink the directory to fit them, as I think you are saying? If not, then
> how?

1. Switch to XFS, it is reported to auto-shrink directories automatically


2. unmount filesystem and run e2fsck -D on it every so often.


3.  suppose foo is the directory in need of shrinking, and that newfoo doesn't exist:

    "mkdir newfoo && cp -alr foo/. newfoo/. && mv foo oldfoo && mv newfoo foo && rm -fr oldfoo" at a time nothing is using "foo".

there are other possible solutions to the problem, of course.

  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique de Moraes Holschuh <hmh@debian.org>

Reply to: