Solved

mail: can't stat mailfile larger than 2gb

Posted on 2010-11-10
7
3,024 Views
Last Modified: 2012-05-10
Hello,

I have a solaris 10 server running Oracle. The oracle app created a file larger than 2gb in /var/mail directory. when tried to run mailx under that user, it'll report:
mail: can't stat mailfile.

I believe this is a normal behavior for Oracle to create the log file in the /var/mail directory with larger than 2gb.

The Os is using vxfs so the 2gb file limitation should not be an issue.

example:

# pwd
/var/mail
# ls -lh
total 11266464
drwxrwxr-x   2 root     mail          96 Nov  9 13:56 :saved
-rw-rw----   1 test mail        2.4G Nov 10 13:30 test
-rw-------   1 ambi    other       2.0G Nov 10 14:44 ambi
-rw-rw----   1 root     mail        516K Dec 16  2009 root

# mail
mail: Cannot stat mailfile

If I remove the file(ambi), then I can send mail with no problem

# rm ambi

# pwd
/var/mail

# ls -lh
total 7072144
drwxrwxr-x   2 root     mail          96 Nov  9 13:56 :saved
-rw-rw----   1 test mail        2.4G Nov 10 13:30 test
-rw-rw----   1 root     mail        516K Dec 16  2009 root

# mail
No mail.


Please let me know if you need more info.

Thank You.

bb









0
Comment
Question by:bbbb44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 78

Expert Comment

by:arnold
ID: 34107932
See if owner/group  is the issue.

chgroup mail /var/mail/ambi

i.e. if you create any file in /var/mail/filename where mail is not the group do you get the same issue.  
Is the file created by oracle has the correct format for a mailbox?

I think the normal location would be within $ORA_HOME/var/log
/var/mail should only have mailboxes created by MTA/MDA.
0
 

Author Comment

by:bbbb44
ID: 34122265
Hi,

I changed the group to mail, but the issue still there.

not sure what do you mean by correct format for oracle. when I create a file that's larger than 2gb for a test user, it'll also error out with the same error.

Is there any limitation that will prevent mailx to work if the file is larger than 2gb?

Thanks,

Bb
0
 
LVL 78

Expert Comment

by:arnold
ID: 34122453
is the file that is being dropped/saved in /var/mail in a valid email mailbox format?

Only the MTA should be saving data in /var/mail nothing else should be saving files there if it is not a file in proper mailbox format.

/var/mail should not be used as a storage space for other applications.  Change the location where oracle saves whatever this file is to /opt/oracle/ or /var/oracle anywhere you want the file other than locations that have specific meaning/purpose.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bbbb44
ID: 34123413
I believe it's a typical  mail log created when oracle app sents out alert and it's just append to this log file.

Example:

User is testmail, when there’s no mailfile larger than 2gb, then it’s working fine:

-bash-3.00$ pwd
/var/mail
-bash-3.00$ ls -l
total 7072160
drwxrwxr-x   2 root     mail          96 Nov  9 13:56 :saved
-rw-rw----   1 oratest mail     2546647790 Nov 11 12:50 oratest
-rw-rw----   1 root     mail      528394 Dec 16  2009 root
-rw-------   1 mm other    1073741824 Nov 10 14:23  mm

-bash-3.00$
-bash-3.00$ id
uid=5011(testmail) gid=1(other)
-bash-3.00$ mail
No mail.                          <<<<<<<<<<<<<<<<<<<<<< it works when there’s no file larger than 2gb for testmail
-bash-3.00$


When created file larger than 2gb, then it’ll failed with error:

-bash-3.00$ pwd
/var/mail
-bash-3.00$
-bash-3.00$ mkfile 2g testmail
-bash-3.00$
-bash-3.00$ ls -l
total 11266480
drwxrwxr-x   2 root     mail          96 Nov  9 13:56 :saved
-rw-rw----   1 oratest mail     2546647790 Nov 11 12:50 oratest
-rw-------   1 testmail   mail    2147483648 Nov 12 10:38 testmail       <<<<<<<<<<<<<<newly created 2gb file
-rw-rw----   1 root     mail      528394 Dec 16  2009 root
-bash-3.00$
-bash-3.00$
-bash-3.00$ mail
mail: Cannot stat mailfile                <<<<<<<<<<<<<<<<<<< then it doesn’t work.


So, is there any limitation in the /var/mail directory?


Thanks for the reply.

bb
0
 
LVL 78

Accepted Solution

by:
arnold earned 500 total points
ID: 34123537
The message needs to be email it can not be directly saved into the /var/mail/username folder.

i.e. you would not use /usr/bin as a storage location, don't use /var/mail for that purpose.

The limitation is based on the processing of the email server (sendmail, postfix, etc.) and the filesystem limit dealing with the size of the file which I do not think is an issue.

An alternative to mailbox as a means to store email message is the use of a Maildir/ where each message is stored in an individual file within a directory structure for
Maildir
   new  - newly arrived emails
   cur - read
   tmp - temporary space that is used during the delivery of the message
0
 

Author Comment

by:bbbb44
ID: 34366150
issue resolved.

thanks for the help

b4
0
 

Author Closing Comment

by:bbbb44
ID: 36052329
acceptefd
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question