This site is now 100% read-only, and retired.

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!

 

 


Re: Preventing /tmp from being cleaned on reboot
Posted by Anonymous (194.47.xx.xx) on Tue 25 Jan 2005 at 00:08
Don't do that, you'll grow used to keeping things in /tmp and then when you use some other machine you'll lose all your files. Put files in /var/tmp instead; they won't get deleted there.

[ Parent ]

Re: Preventing /tmp from being cleaned on reboot
Posted by Steve (82.41.xx.xx) on Tue 25 Jan 2005 at 18:49
[ 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 ]

Re: Preventing /tmp from being cleaned on reboot
Posted by docelic (213.202.xx.xx) on Sat 29 Jan 2005 at 00:45
All notes apply, but from my experience /var/tmp was the right thing.

[ Parent ]

Re: Preventing /tmp from being cleaned on reboot
Posted by Anonymous (82.235.xx.xx) on Mon 31 Jan 2005 at 21:11
This behaviour is braindead. /tmp *should* be cleared on reboot - processes should put pidfiles and the like in there, there is no reasonable explanation why those shouldn't go at reboot. With cheaper RAM, tmp in RAM/swap is the way chosen bymost sensible OSes, and it's just plain wrong to expect that to last out a reboot.

[ Parent ]

Re: Preventing /tmp from being cleaned on reboot
Posted by Steve (82.41.xx.xx) on Tue 1 Feb 2005 at 09:20
[ 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 ]

Re: Preventing /tmp from being cleaned on reboot
Posted by Demitsu (84.176.xx.xx) on Mon 26 Sep 2005 at 23:20
Mhh, I've got /tmp symlinked to /var/tmp. On second sight, this seems to be a dangerous habit...

[ Parent ]

Polish translation
Posted by ptecza (193.0.xx.xx) on Fri 18 Feb 2005 at 10:26
Hello Men! :)

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 ]

Re: Preventing /tmp from being cleaned on reboot
Posted by Anonymous (81.56.xx.xx) on Wed 4 May 2005 at 11:42
A previous user wrote that /tmp should always be cleaned. That's nearly true.
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 ]

Re: Preventing /tmp from being cleaned on reboot
Posted by ajt (204.193.xx.xx) on Wed 4 May 2005 at 11:52
[ View Weblogs ]
Actually our RedHat machines at work delete things from /tmp automatically with some tmpwatch script thing... Cleaning /tmp on reboot is probably a good idea as long as you know about it, in advance.

--
Adam

[ Parent ]

Re: Preventing /tmp from being cleaned on reboot
Posted by Anonymous (213.70.xx.xx) on Thu 19 May 2005 at 19:13
The only user that should want to put things into /tmp instead of /var/tmp is an administrator doing maintenance stuff in single user mode, when /var is not mounted. In all other cases, your TMP, TMPDIR, and like variables should point to /var/tmp.

[ Parent ]