Postfix and tmpfs for /var/spool
- by Rob Fisher
My main disk is an SSD so in order to preserve its lifetime by reducing writes I followed some advice and made /var/spool a ram disk by adding this line to /etc/fstab:
tmpfs /var/spool tmpfs defaults,noatime,mode=1777 0 0
Later I configured postfix because I have a RAID array on my system and mdadm wants to send me email if the RAID array fails which sounds like a fine idea. Email sending worked fine until I rebooted, at which point:
postfix: fatal: open /etc/postfix-out/main.cf: No such file or directory
The fix for this is apparently:
mkdir /var/spool/postfix
postfix check
Then I found I also had to do:
mkfifo /var/spool/postfix/public/pickup
service postfix restart
Now sending emails works fine...until the next reboot.
So: what is the most correct way to recreate the contents of /var/spool/postfix automatically at boot time if it does not exist?
I am using Ubuntu Server 12.04.