Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a CentOS 6 server at rackspace with 40GB of space. My server kept crashing with 'no space left on device' errors but there is over 50% free.

When I run df-i this is the output:

/dev/xvda1           2490368 2490351      17  100% /

I traced the problem to postdrop I think. Before I disabled postfix and postdrop the inodes would fill up immediately as soon as I freed any up.

From what I can see, there are thousands upon thousands of files being created in /var/spool/postfix/maildrop. The folder itself is 67MB. I can't "ls" the folder, I've tried to "rm -rf maildrop/" which just hangs for a long time.

How can I remove this folder. I don't even use mail on the server so I've disabled postfix and postdrop and sendmail.

drwx-wx---. 2 postfix postdrop  67M Dec 18 18:25 maildrop 

Just wanted to update:

ls -1 | xargs -I{} rm {}

the above command solved the problem

It took 48 hours on and off. There appeared to be almost 2,000,000 files in the /var/spool/postfix/maildrop folder.

share|improve this question

migrated from stackoverflow.com Jan 14 '13 at 4:01

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 3 down vote accepted

If you have a directory full of files, normally you can not just remove all files with rm

Try with:

find /path/to/directory -type f -exec rm {} \;

Or try with:

ls -1 /path/to/directory | xargs -I{} rm {}

In other words you have to try to split the command in two, a part that handle the files and another that remove the files.

When you have a zillion of files into one directory you can't remove files using commands like rm. because rm in any case iterate between all files and directory.

share|improve this answer
Normally "rm -rf foldername" should just delete the entire folder though. So wouldn't running 'find' and then 'rm' take even longer on that folder. I'm going to assume there are a hundreds of thousands of files in there? –  gteh Dec 18 '12 at 18:49
what would ls -1 | xargs -I{} rm {} do exactly? –  gteh Dec 18 '12 at 18:50
Will execute one rm for file, you could also try with ls -1 | xargs rm but some versions of xargs doesn't work well. Can't handle so many files –  freedev Dec 18 '12 at 18:56
ok thanks, I'll try both methods and see what works. I need to get my ssh session to stop closing after inactivity though otherwise this command will never finish. –  gteh Dec 18 '12 at 18:57
I had directories with 300k files... This solution works. –  freedev Dec 18 '12 at 18:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.