From owner-freebsd-questions@FreeBSD.ORG Thu Feb 24 13:12:09 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 07A1816A4CE for ; Thu, 24 Feb 2005 13:12:09 +0000 (GMT) Received: from male.aldigital.co.uk (male.thebunker.net [213.129.64.13]) by mx1.FreeBSD.org (Postfix) with ESMTP id A6D8943D39 for ; Thu, 24 Feb 2005 13:12:08 +0000 (GMT) (envelope-from matthew@thebunker.net) Received: from gravitas.thebunker.net (gateway.ash.thebunker.net [213.129.64.4]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by male.aldigital.co.uk (Postfix) with ESMTP id 2A02B976FA; Thu, 24 Feb 2005 13:12:07 +0000 (GMT) Received: from gravitas.thebunker.net (localhost [127.0.0.1]) j1ODC0RC020036; Thu, 24 Feb 2005 13:12:00 GMT (envelope-from matthew@gravitas.thebunker.net) Received: (from matthew@localhost) by gravitas.thebunker.net (8.13.1/8.13.1/Submit) id j1ODC0ia020035; Thu, 24 Feb 2005 13:12:00 GMT (envelope-from matthew) Date: Thu, 24 Feb 2005 13:12:00 +0000 From: Matthew Seaman To: Paul Richards Message-ID: <20050224131200.GA16494@gravitas.thebunker.net> Mail-Followup-To: Matthew Seaman , Paul Richards , questions@freebsd.org References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Nq2Wo0NMKNjxTN9z" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i cc: questions@freebsd.org Subject: Re: Cleaning /tmp on boot X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Feb 2005 13:12:09 -0000 --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--