Solved

mail: can't stat mailfile larger than 2gb

Posted on 2010-11-10
7
2,963 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
  • 4
  • 3
7 Comments
 
LVL 77

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 77

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 77

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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

813 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now