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.

  • 1
    What do you have using /var/spool if you didn't have postfix on before? Unless you are running a news server or busy mail server, you arne't doing a thing by putting /var/spool on a tmpfs, and if you are, you are creating a wonderful way to lose mail. – psusi Nov 8 '12 at 0:04
  • Thanks psusi, I am coming around to that way of thinking. The only other thing in there is /var/spool/cron. I think perhaps I followed the advice on that other page a little too blindly. – Rob Fisher Nov 8 '12 at 11:13
  • I followed the advice on that page as well when I bought my SSD. I had so many issues with it! The one that I noticed was that anacron wasn't running, probably because it couldn't write into /var/spool . I ended up not using RAM disks. Also, if you have another spindle HDD, you might think about moving some stuff onto it with mount bind, but don't use symlinks. See this thread for my tale of woe forum.kde.org/viewtopic.php?f=225&t=109329 (but yeah, I suspect that none of this was necessary with the lifespan of new SSDs). – Sparhawk Dec 29 '12 at 10:03

Yeah, just don't do this. You didn't specify your model of SSD, but Intel and Crucial/Micron SSDs are generally rated for something like 25% of the drive's total capacity in writes per day for 5 years minimum. You're vanishingly unlikely to go anywhere near that here unless there's something really, really mind-boggling about your setup that you haven't described.

| improve this answer | |

Beware of putting /var/spool/ on tmpfs!

User CRON JOBS are stored under /var/spool/ on Ubuntu!

If you put /var/spool/ on tmpfs you will not be able to have any user cron jobs because they will be erased on every shutdown.

The system crontab however is located in /etc/crontab and is edited directly NOT with the crontab -e command. found this out the hard way :-(

| improve this answer | |

/var/spool should not be the tmpfs mount for postfix. Use the active queue directory path for postfix i.e.; /var/spool/postfix/active. Make sure you have a battery backup and dual power for that system to reduce the risk of data loss. Your inactive (retry queue) postfix dir should be on regular disk or SSD. TMPFS can be used in production, it just takes planning time and patience. I have had some applications on TMPFS and they completely slam SSD hands down 0 iowait even in the highest loads (thousands of "requests" per sec).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.