• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3156
  • Last Modified:

mail: can't stat mailfile larger than 2gb

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
bbbb44
Asked:
bbbb44
  • 4
  • 3
1 Solution
 
arnoldCommented:
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
 
bbbb44Author Commented:
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
 
arnoldCommented:
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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
bbbb44Author Commented:
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
 
arnoldCommented:
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
 
bbbb44Author Commented:
issue resolved.

thanks for the help

b4
0
 
bbbb44Author Commented:
acceptefd
0

Featured Post

Industry Leaders: 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!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now