cancel
Showing results for 
Search instead for 
Did you mean: 

Too Much Mail

SOLVED
Go to solution
David Crowe
Advisor

Too Much Mail

The ROOT mailbox is approaching 280 MB and is too large to open. Is there a way to delete this mail without opening it or can I just go into var/mail/ and delete the file.
9 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: Too Much Mail

Hi David:

If you want to dispose of everything, just:

# cat /dev/null > /var/mail/

...JRF...
someone_4
Honored Contributor

Re: Too Much Mail

hello
if you dont want the mail
> /var/mail

someone_4
Honored Contributor

Re: Too Much Mail

what is the difference in
cat /dev/null > /var/mail/
and
> /var/mail/


Richard
Jim Turner
HPE Blogger

Re: Too Much Mail

Richard,

About 14 bytes' worth of KB input :-)

Cheers,
Jim

-----
Was this information helpful? If so, please like and give kudos. Thanks!
Sanjay_6
Honored Contributor

Re: Too Much Mail

Hi David,

You can delete the file too. It will recreate the file if it gets any new mail. Else yoou can make its size as "0"

cat /dev/null >/var/mail/root

Thanks
Victor_5
Trusted Contributor

Re: Too Much Mail

Try to use tail to open the file, if you have make sure you donot need them any more, you can use the attached shell to clear them. The shell can be put in crontab.

tail /var/mail/root

Shawn
David Crowe
Advisor

Re: Too Much Mail

Thanks everybody for your replies. I thought that's what I need to do but I was worried because it creates a "sys" file and not a "mail" file. Once it writes to it, will change to a mail file?
Sridhar Bhaskarla
Honored Contributor

Re: Too Much Mail

David,

root mailbox will have some important messages like cron failures, EMS messsages etc.,. So you would want to keep a copy of it before you null it. So, move it to another file system that has some space. It is growing means system really wants to tell you something.

#cp /var/mail/root /another_file_system
#cat /dev/null > /var/mail/root

Now you can use pg or cat command to view this file to see what the messages are. Once you are satisfied that there is no danger indicated in it, you can delete it from that file system.

I know I won't get cents for this message but thought of letting you know.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Wodisch
Honored Contributor

Re: Too Much Mail

Hello,

a UN*X mailbox is just a text file (maybe a huge one ;-)
and the syntax for SMTP mail (=UN*X) is pretty simple...
At least test for the "subject" lines of all those mails:

grep "^Subject: " /var/spool/mail | more

before you delete it - there might be an interesting
message in there!

HTH,
Wodisch