extremely slow "ls" on a cleared fatty ext3 directory on FC4/5
Michael Hennebry
hennebry at web.cs.ndsu.nodak.edu
Mon Aug 14 18:43:14 UTC 2006
On Sun, 13 Aug 2006, Robinson Tiemuqinke wrote
that /tmp on an ext3 filesystem had held 5 million plain files,
that he deleted most of them,
that though the files are gone
just listing the remaining 8 files of /tmp
takes 20 minutes.
> -bash-3.00# ls -alFdh /tmp*
> drwxrwxrwt 4 root staff 4.0K Aug 12 23:17 new_tmp/
> drwxrwxrwt 4 root staff 131M Aug 12 20:30 tmp/
>
> Anyone know why the former fatty directory still looks
> unchanged and takes hours to traverse even after
> 99.999999% files got removed?
Another poster stated that on ext3,
directories can grow, but not shrink.
> If there are any ways to fix this kind of problem
> without rebooting machine? I'm afraid of the commands
> "rsync -avHn /tmp/ /new_tmp/; rm -rf /tmp/ && mv
> /new_tmp/ /tmp" because other applications are
> accessing /tmp/ as well.
If /tmp is its entire partition, I think that the only way
is to reformat the partition.
You don't necessarily have to reboot, but you will need to kick off
anyone using /tmp .
If /tmp is a soft link to /fred/tmp and /fred is its entire partition,
you might be able to do something like this.
# cd /fred
# mkdir new.tmp
# cd new.tmp
# ln ../tmp/* . # hard links won't work on directories
# cd ..
# mv tmp old.tmp
# # 'twould be best if no one tried to use /tmp at this point
# mv new.tmp tmp
# rm -r old.tmp
There might still be problems if someone had the
original /tmp as the current directory or just open.
--
Mike hennebry at web.cs.ndsu.NoDak.edu
"it stands to reason that they weren't always called the ancients."
-- Daniel Jackson
More information about the Ext3-users
mailing list