I’m using Amazon Linux. Below is the uname info …

[davea@mymachine ~]$ uname -a
Linux sandbox.mydomain.com 4.4.18-35.99.amzn1.x86_64 #1 SMP Wed Jul 27 22:37:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Even when I do a

sudo reboot now

The /tmp directory isn’t getting cleaned out. I verify this by noting that the dates on the files are before the reboot. How can I set things up so that when I reboot, the /tmp directory is cleaned out?

Edit: Per the request in the comment, below is the /etc/fstab file

LABEL=/     /           ext4    defaults,noatime  1   1
tmpfs       /dev/shm    tmpfs   defaults        0   0
devpts      /dev/pts    devpts  gid=5,mode=620  0   0
sysfs       /sys        sysfs   defaults        0   0
proc        /proc       proc    defaults        0   0
  • I imagine your expectation for the /tmp directory to be cleaned is because you're used to a tmpfs filesystem mounted on tmp from some other distro/configuration. It sounds like your /tmp directory is a partition on your hard drive instead. How about you post your /etc/fstab? You can easily change what get mounted on /tmp with it. – Centimane Oct 7 '16 at 17:10
  • Done! It is attached as an edit to my question. – Dave Oct 7 '16 at 18:59

To introduce a 1GB /tmp that sits in tmpfs and therefore clears on boot, add this line to /etc/fstab and then reboot.

tmpfs   /tmp         tmpfs   nodev,nosuid,size=1G          0  0

More info on Arch wiki

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.