Using a RAMdrive with MIMEDefang on FreeBSD

Before I deploy the new spam scanning servers which run a combination of:

  • Sendmail
  • MIMEDefang
  • SpamAssassin
  • Milter-Greylist

I’d like to set the spool directory to run on a ramdrive to increase the speed an efficiency of the system. When MIMEDefang kicks off, the message is written to disk which can cause an IO bottleneck. All of the data written is deleted pretty much straight away and does not need to survive a reboot. On my FreeBSD install the default location for the spool is /var/spool/MIMEDefang/

I found a little script on the internet which I modified to make work for me. MIMEDefang is fussy about the owner and permissions of the directory in which the pid and sock file reside which is also in /var/spool/MIMEDefang. Heres the script:


case "$1" in
/sbin/mdmfs -S -s $SIZE md0 $MOUNT_DIR
chown -R mailnull:mailnull $MOUNT_DIR
chmod 0710 $MOUNT_DIR
echo "$SIZE ramdisk created on /dev/md0 and mounted on $MOUNT_DIR"
/usr/local/etc/rc.d/mimedefang restart
exit 0
/sbin/umount $MOUNT_DIR
/sbin/mdconfig -d -u 0
echo "ramdisk unmounted from $MOUNT_DIR and deleted from /dev/md0"
$0 stop
$0 start
echo "Usage: `basename $0` {start|stop|restart}"2
exit 64

You can make this happen by typing:

./ start

I keep the script in /usr/local/etc/rc.d/ so the RAMdrive is created on startup.

This entry was posted in FreeBSD Administration, MIMEDefang and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *