On Thu, Feb 24, 2005 at 12:42:17PM +0000, Paul Richards wrote:

> Is there an easy way to have FreeBSD (RELEASE-5.3) clean /tmp on boot
> by means of setting a flag or something in /etc/rc.conf?  I'd like to
> check before I start manually hacking up my boot scripts to get this
> done.

Add:

   clear_tmp_enable="YES"

to /etc/rc.conf.  Also consider 'daily_clean_tmps_enable="YES"' in
/etc/periodic.conf, which will enable a daily job to clean out old
files from temporary directories.
 
> Alternatively, is there something similar to tmpfs from Linux
> available on FreeBSD?  I've heard about mfs but it statically
> allocates memory from the VM, I'd prefer if allocation was done only
> as needed on demand.

Yes -- correct, it is called 'mdmfs' under 5.x -- but it isn't
necessarily true that it allocates memory out of VM: depending on the
arguments used when configuring the underlying md(4) device, the
memory can be swap or file backed. When it's used to provide a /tmp
filesystem, it is specifically swap backed.  As is explained in the
mdmfs(8) man page. Add the following to /etc/rc.conf to enable using a
memory filesystem for /tmp:

    tmpmfs="YES"
    tmpsize="128m"
    
Note that tmpsize should be smaller than the amount of swap space on
your machine -- preferably quite a bit smaller -- or you can end up
with a situation where any user can potentially DoS your server simply
by creating files under /tmp

   Cheers,

   Matthew   

-- 
Dr Matthew J Seaman MA, D.Phil.                       8 Dane Court Manor
                                                      School Rd
PGP: http://www.infracaninophile.co.uk/pgpkey         Tilmanstone
Tel: +44 1304 617253                                  Kent, CT14 0JL UK

Attachment: pgpezNfsZvm2x.pgp
Description: PGP signature

Reply via email to