codeblog code is freedom — patching my itch

March 10, 2010

Clearing /tmp on boot

Filed under: Blogging,Debian,Ubuntu,Ubuntu-Server — kees @ 3:48 pm

I don’t like unconditionally clearing /tmp on boot, since I’m invariably working on something in there when my system locks up. But I do like /tmp getting cleaned up from time to time. As a compromise, I’ve set TMPTIME=7 in /etc/default/rcS so that only stuff older than 7 days is deleted when I reboot.

© 2010, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 License.
CC BY-SA 4.0

7 Comments

  1. I make /tmp be in RAM with tmpfs.

    Comment by Joseph — March 10, 2010 @ 6:03 pm

  2. Yikes, I can’t retain 7 days of files with a tmpfs. ;)

    Comment by kees — March 10, 2010 @ 6:14 pm

  3. Isn’t that what /var/tmp is for?

    (a random copy of the fs hierarchy standard)
    http://www.pathname.com/fhs/2.2/fhs-5.15.html

    Comment by John Eikenberry — March 10, 2010 @ 7:26 pm

  4. I use tmpreaper rather than something that happens at boot, since how often I reboot my system tends not to have much to do with how often I want /tmp cleaned.

    Comment by Russ Allbery — March 10, 2010 @ 7:48 pm

  5. I really enjoy doing important work in /tmp, it gives my job a daredevil feel that i’ll lose work if the box crashes. :)

    Comment by Dave Walker (Daviey) — March 11, 2010 @ 6:14 am

  6. I used to use TMPTIME but it delayed the boot process for many many seconds (also had some issues with relatime, nodiratime and TMPTIME). Now I use /var/tmp for stuff I want to preserve and mount a ramfs on /tmp.

    Comment by Raphael Geissert — March 11, 2010 @ 6:04 pm

  7. I enjoy the feeling of bliss a clean /tmp gives me after reboot.

    Comment by Rathernot — March 11, 2010 @ 7:50 pm

Powered by WordPress