Inode Preservation Possible?

Neal Morgan Neal at
Fri May 9 18:42:48 IST 2008

Julian Field wrote:
> Neal Morgan wrote:
> > Hi Julian and list!
> >
> > I've been using MailScanner with ZMailer successfully for some time.
> > One thing I didn't like was the fact that there was a "disconnect"
> > the logs (syslog, mail) between the message ID when received by
> > handed off to MS, taken again by router/scheduler.  This made it
> > difficult to diagnose problems with individual messages.
> >
> > I'll try to keep the background info short.  Zmailer derives a
> > ID from the inode and create date.  If I could keep the message in
> > same/original file, the logging would stay correct from ZM to MS and
> > back.
> >
> > I managed to build on the work of others (Carlos?), added some of my
> > scripts to preserve the original inode through copying and cat'ing.
> > works but it's kind of ugly.
> >
> > So, the question is, would it be possible to make MailScanner do
> > for me?  In other words, don't delete the incoming file, instead
copy it
> > to its work area, perform whatever changes are necessary, then put
> > altered content BACK into the original file so the inode would be
> > preserved?
> And what happens when the power dies or the OS crashes when you are 
> half-way through over-writing the content of the original file? I
> like this *at all*, sorry.
> >    ...finally, and equally important, use a "mv" to put in the
> > outgoing folder rather than copying.
> >   
> I can only mv if I'm not modifying the file.
> MailScanner never "owns" a message, as a power outage or crash could 
> cause you to lose a message.
> Jules

Thanks for your feedback.

That's a valid concern.  My ugly hack addresses this by keeping the
original and sending a copy to MS.  The original is only touched when I
have a valid match in output from MS.  At this point, the contents of
the original are replaced with the contents of the file from MS.  If
there were a problem I still have the output from MS, so I haven't lost

What I'm trying to accomplish here is to have a complete audit trail in
syslog as the message moves through the various processes.  It's a real
pain in the neck to troubleshoot if the ID changes when the messages
enters MS and is returned.  

Below is a sample of what I've managed to accomplish with my hack.  (If
you know the message of interest was "S1049805AbYEIRIA" when received by
smtpserver, you can grep for that in syslog).  

I'm just wondering if there is a better way to accomplish this:

10:08:00 smtpserver[21196]: S1049805AbYEIRIA: (9813c) accepted from
10:08:15 MailScanner[13776]: ZMMS: (S1049805AbYEIRIA) ID=1049805
10:08:15 MailScanner[13776]: ZMMS: (S1049805AbYEIRIA) Creating rename
map: D/1065521 back to D/1049805
10:08:27 router[21264]: ZMMS: (S1049805AbYEIRIA) D/1049805 has been
scanned and is now being routed
10:08:27 router[3594]: S1049805AbYEIRIA:
from=<someaddress at>, <snip>
10:08:27 smtp[14101]: S1049805AbYEIRIA: to=<someotheraddress
someaddress at>, delay=<snip>
10:08:27 scheduler[3579]: S1049805AbYEIRIA: complete (total 1
recipients, 0 failed)

With the default MS/ZM setup, the "S1049805AbYEIRIA" ID would have
changed at least once, and there would be no way to draw a conclusion
about what its new ID is without manually scanning the order of syslog
recs and trying to interpolate.  (That ID is derived from inode and
create date.  A new file back from MS generates a different ID.)

Thanks again for your feedback.  If you don't have any other suggestions
I guess I'll just keep my hack...


Neal Morgan

More information about the MailScanner mailing list