Solved

mail: can't stat mailfile larger than 2gb

Posted on 2010-11-10
7
2,911 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 76

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 76

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 76

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

746 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

12 Experts available now in Live!

Get 1:1 Help Now