I was just looking a good way to mount
/tmp directory on AWS EC2 ephemeral storage automatically. Then I stumbled on this post. Nice method if you are using Ubuntu (or other distribution that uses Upstart).
# File /etc/init/mounted-mnt.conf # mounted-mnt - Binds /tmp to /mnt/tmp description "Binds /tmp to /mnt/tmp" start on mounted MOUNTPOINT=/mnt task script test -d /mnt/tmp || mkdir -m 1777 /mnt/tmp mount --bind /mnt/tmp /tmp end script
And the good idea behind this, as told in the post, is
Some servers, like Apache/Passenger, might create important temporary files on /tmp. Once rc.local – the last in the boot sequence – ran they would get hidden and confuse the servers.