Date: Thu, 24 Feb 2005 13:12:00 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Paul Richards <paul.richards@gmail.com> Cc: questions@freebsd.org Subject: Re: Cleaning /tmp on boot Message-ID: <20050224131200.GA16494@gravitas.thebunker.net> In-Reply-To: <a1138db305022404423f7afde4@mail.gmail.com> References: <a1138db305022404423f7afde4@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=3D"YES" to /etc/rc.conf. Also consider 'daily_clean_tmps_enable=3D"YES"' in /etc/periodic.conf, which will enable a daily job to clean out old files from temporary directories. =20 > 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=3D"YES" tmpsize=3D"128m" =20 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 =20 --=20 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 --Nq2Wo0NMKNjxTN9z Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iQCVAwUBQh3SoJr7OpndfbmCAQIOKAP/RFJbM50+/jPZ6kiunMFxWh/fpMYqKR7Y VIR0vjScBmAXy2xRnuS3YfOXUh3V1D+zlgQLYmVZXjzFO7qnLrn1npBXgmikT2qZ pyohDxFNUwB2sArKuO8lXICIbdnjxy3/6ntMlOh2OoJ1b3Q55vF/8pOrh0xuOfLV Es2CRGlPUjc= =/Je9 -----END PGP SIGNATURE----- --Nq2Wo0NMKNjxTN9z--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050224131200.GA16494>