I have been trying to delete a directory from a centos server using rm -Rf /root/FFDC for the past 15 hours and am having great difficulty. I can't do a directory listing because it hangs the system (too many files?) but what I can see is that the directory size is not the usual 4096 bytes but 488MB!

[root@IS-11034 ~]# ls -al
total 11760008
drwxr-x--- 31 root root        4096 Aug 10 18:28 .
drwxr-xr-x 25 root root        4096 Aug 10 16:50 ..
drwxr-xr-x  2 root root   488701952 Aug 11 12:20 FFDC

I've checked the inodes and everything seems fine. I've checked top and rm is still using the cpu after 15 hours at 0.7%. Filesystem type is ext3.

I'm clueless where to go now apart from backup and format.

link|improve this question

45% accept rate
What happens if you stat that directory? – Andrew Aug 11 '10 at 16:12
feedback

3 Answers

up vote 1 down vote accepted

Is even ls -1f /root/FFDC slow? With -1f the output won't be sorted and the file details will be left out.

If the ls above runs fast, perhaps something like find /root/FFDC | xargs rm -vf would be faster? A normal rm -rf might do all kind of recursion which the findMIGHT be able to skip. Or then not.

Is your filesystem mounted with sync option? If it is, then the write/delete performance is horribly slower than it could be with async. If in doubt, you might try mount -o remount,async / (or mount -o remount,async /root if that's a separate filesystem for you).

link|improve this answer
feedback

Have you considered unmounting the filesystem and then running e2fsck to check the file system for errors? I would try this before backup, format, restore.

link|improve this answer
feedback

running fsck on the filesystem will fix the problem. It usually occurs when a directory used to contain many files but now no longer does. The directory size is given as a huge number and the performance suffers.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.