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:
#!/bin/sh MOUNT_DIR="/var/spool/MIMEDefang" SIZE=256M case "$1" in start) /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 ;; stop) /sbin/umount $MOUNT_DIR /sbin/mdconfig -d -u 0 echo "ramdisk unmounted from $MOUNT_DIR and deleted from /dev/md0" ;; restart) $0 stop $0 start ;; *) echo "Usage: `basename $0` {start|stop|restart}"2 exit 64 ;; esac
You can make this happen by typing:
./my_scriptname.sh start
I keep the script in /usr/local/etc/rc.d/ so the RAMdrive is created on startup.