Preventing /tmp from being cleaned on reboot
Posted by Steve on Mon 24 Jan 2005 at 16:00
Debian machines are normally setup so that the /tmp partition, or directory, is emptied as part of the boot process.
I remember this biting me the first time I upgraded to Debian from RedHat 4.2, I copied all the things I wished to keep from the old installation into the small /tmp partition and then did the install. By the time my machine rebooted into Debian all my files were gone!
If you wish to change this behaviour you need to edit the file /etc/default/rcS.
The setting to change is called TMPTIME, and it defaults to 0 meaning all files are removed.
To delete all files older than a week set it to 7, and to keep all files just set it to a rediculously large value such as 9125 - for preserving files less than 25 years old!
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Perhaps, but on the other hand if all your machines are split between Debian and SuSE you might want them to all behave the same - and keep the files.
Obviously you shouldn't keep important files in /tmp, but keeping temporary files there and expecting them to persist isn't completely unreasonable.
Steve
-- Steve.org.uk
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
PID files, on Debian, live in /var/run, things that are supposed to persist go in /var/tmp, such as vi session files.
On Debian systems /tmp usually just has the X11-lock files, and very little else.
Steve
-- Steve.org.uk
[ Parent | Reply to this comment ]
/tmp/ temporary files that are not guaranteed to persist across system reboots
/var/tmp/ temporary files that are kept between system reboots
By default, /tmp is left as is, which a user can override by adding the line clear_tmp_enable="YES" to /etc/rc.conf. For this reasong symlinking one tmpdir to another is a bad thing to do.
But this is Debian. I'll go increase TMPTIME from 0 to 7 at least, thanks :)
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
I guess that this site is known by Polish Debian users,
so I want to inform them that I've just translated this
short, but in my opinion useful article. It's available
at http://www.debianusers.pl/article.php?aid=70.
Have a nice reading! :)
Pawel
[ Parent | Reply to this comment ]
On a desktop machine, that you always cleanly stop, yes. On a laptop, where the gnome battery warning application does not work, no. Because, if /tmp is cleaned, all the nice openoffice temporary files that are used for having a possibility to restore your document in case of a brutal stop are stored in /tmp.
If /tmp is cleaned, the files are destroyed, and your file are lost. Sad.
[ Parent | Reply to this comment ]
--
Adam
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]