New User? Register here - Existing Users: Username: Password: [Advanced Login]

 

 

Current Poll

What language for system administration do you use ?







( 609 votes ~ 1 comments )

 

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!

Share/Save/Bookmark


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 | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 25 Jan 2005 at 18:49
[ 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 ]

Posted by docelic (213.202.xx.xx) on Sat 29 Jan 2005 at 00:45
[ Send Message ]
All notes apply, but from my experience /var/tmp was the right thing.

[ Parent | Reply to this comment ]

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 | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 1 Feb 2005 at 09:20
[ 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 ]

Posted by rihad (217.64.xx.xx) on Thu 29 Sep 2005 at 12:27
[ Send Message ]
Some excerpts from FreeBSD's hier(7):
/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 ]

Posted by Demitsu (84.176.xx.xx) on Mon 26 Sep 2005 at 23:20
[ Send Message ]
Mhh, I've got /tmp symlinked to /var/tmp. On second sight, this seems to be a dangerous habit...

[ Parent | Reply to this comment ]

Posted by ptecza (193.0.xx.xx) on Fri 18 Feb 2005 at 10:26
[ Send Message ]
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 | Reply to this comment ]

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 | Reply to this comment ]

Posted by ajt (204.193.xx.xx) on Wed 4 May 2005 at 11:52
[ Send Message | 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 | Reply to this comment ]

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 | Reply to this comment ]

 

 

Flattr