[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: is it save to clean /var/tmp?



Andreas Janssen wrote:
> William Ballard wrote:
> > /tmp seems to clean itself up on reboots; but /var/tmp contains a
> > vi.recover which I think is making me receive annoying mails about how
> > I can recover my files every time I reboot.

Probably the expectation is that you would recover those files from vi
and discard them if you don't want them.  Try 'nvi -r'.

> > I'm going to delete /var/tmp/vi.recover, but is it safe to delete
> > everything else in /var/tmp after a reboot?
> 
> Basically: no. it is not safe. From the File Hierarchy Standard (2.3):

I am going to disagree with my esteemed colleague and say yes, with
restrictions.  Are you the only person using your computer?  If so
then you can only hurt yourself.  If the answer is that this is a
multiuser machine, say a university or large corporate business
machine, then no.  You might be killing off someone else's work.  But
if it is your own machine then fine.

> |/var/tmp : Temporary files preserved between system reboots
> |
> |Purpose
> |
> |The /var/tmp directory is made available for programs that
> |requiretemporary files or directories that are preserved between system
> |reboots. Therefore, data stored in /var/tmp is more persistent than
> |data in /tmp.

Those FHS rules apply to the system.  And I agree with them.  But the
administrator of the machine is allowed to set local policies which
override the FHS.  See "site-specific manner" below.

> |Files and directories located in /var/tmp must not be deleted when the 
> |system is booted. Although data stored in /var/tmp is typically deleted 
> |in a site-specific manner, it is recommended that deletions occur at a 
> |less frequent interval than /tmp.   
> 
> You can of course delete the files from time to time, but probably some 
> apps expect their files to still be there after reboot. 

One example is the one which started this.  'nvi' is one which expects
/var/tmp/vi.recover to be persistent across a reboot.

But a reasonable site-specific policy could be to delete files older
than a week.  The 'tmpreaper' package provides this for Debian.  It is
a fork of the Red hat 'tmpwatcher' package.

  apt-cache show tmpreaper
  apt-get install tmpreaper

Then modify /etc/tmpreaper.conf for something like the following.  Use
your own site-specific policy here.

  TMPREAPER_TIME=7d
  TMPREAPER_DIRS='/tmp/. /var/tmp/.'

Bob

Attachment: pgp4SEt3Ro024.pgp
Description: PGP signature


Reply to: