A couple of days ago, I was doing some admin work on a BSD system. "df -kh" showed me that the /var partition had 35G used, taking up over 98% of its allocated space... 
I found this nice command displaying the disk usage of each file/ directory:
# cd /var
# du -sk *
"du" stands for disk usage, the "k" option means KBytes (alternatively, use "m" for MB). 
It turned out the /var/spool/clientmqueue/* was full,  possibly because one of the programs kept trying to send mail (although I had sendmail disabled under /etc/rc.conf, but that's a different story). 
There were so many files under this directory that a "rm -rf ./*" returned a "Argument list too long" error.  Instead, I had to use: 
# ls | xargs rm
Which pipes the outputs from "ls" to "rm". Unfortunately, there were also too much arguments for "ls" to handle. 
As I was about to head off, I decided to remove the entire directory:
# nohup rm -rf /var/spool/clientmqueue/* &
"nohup" lets the process run after I have logged off, with "&" putting it into the background... and problem solved. 
 
 
No comments:
Post a Comment