From owner-cvs-all Mon Jan 29 8:28:56 2001 Delivered-To: cvs-all@freebsd.org Received: from lists01.iafrica.com (lists01.iafrica.com [196.7.0.141]) by hub.freebsd.org (Postfix) with ESMTP id EB82537B699; Mon, 29 Jan 2001 08:28:21 -0800 (PST) Received: from nwl.fw.uunet.co.za ([196.31.2.162]) by lists01.iafrica.com with esmtp (Exim 3.12 #2) id 14NH9s-00058z-00; Mon, 29 Jan 2001 18:28:00 +0200 Received: (from nobody@localhost) by nwl.fw.uunet.co.za (8.8.8/8.6.9) id SAA28354; Mon, 29 Jan 2001 18:27:56 +0200 (SAST) Received: by nwl.fw.uunet.co.za via recvmail id 26889; Mon Jan 29 18:23:44 2001 Received: from sheldonh (helo=axl.fw.uunet.co.za) by axl.fw.uunet.co.za with local-esmtp (Exim 3.20 #1) id 14NH5k-0000A6-00; Mon, 29 Jan 2001 18:23:44 +0200 From: Sheldon Hearn To: Poul-Henning Kamp Cc: mjacob@feral.com, Matt Dillon , John Baldwin , cvs-all@freebsd.org, cvs-committers@freebsd.org, Mikhail Teterin Subject: Re: workaround for broken mfs using vn. (was Re: cvs commit: src/sys/i386/conf GENERIC ) In-reply-to: Your message of "Mon, 29 Jan 2001 15:21:21 +0100." <21404.980778081@critter> Date: Mon, 29 Jan 2001 18:23:44 +0200 Message-ID: <625.980785424@axl.fw.uunet.co.za> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, 29 Jan 2001 15:21:21 +0100, Poul-Henning Kamp wrote: > Uhm, I'm not that KLD savy, but there is no code in md(4) to support unloading > and consequently, it is at best a bad idea. That's fine. The md(4) page doesn't actually suggest that you _can_ unload it, so we're fine for now. Ideally, this should either work for 5.0-RELEASE, or the module build should be disabled for the release. By the way, the patch below would make it much easier for folks to use a swap-backed /tmp in future. Ciao, Sheldon. Index: etc/rc =================================================================== RCS file: /home/ncvs/src/etc/rc,v retrieving revision 1.250 diff -u -d -r1.250 rc --- etc/rc 2001/01/21 20:57:13 1.250 +++ etc/rc 2001/01/29 16:17:47 @@ -196,6 +196,23 @@ ;; esac +case ${swap_backed_tmp_size} in +[Nn][Oo] | '') + ;; +*) + echo 'Mounting swap-backed /tmp' + if ! kldstat -v | grep -E ' md(\.ko|)$' > /dev/null; then + kldload md > /dev/null 2>&1 + fi + unit=`mdconfig -a -t swap -o reserve -s ${swap_backed_tmp_size}` + disklabel -r -w ${unit} auto + newfs -f 4096 /dev/${unit}c + tunefs -n enable /dev/${unit}c + mount /dev/${unit}c /tmp + chmod ${swap_backed_tmp_perm} /tmp + ;; +esac + umount -a >/dev/null 2>&1 # Mount everything except nfs filesystems. Index: etc/defaults/rc.conf =================================================================== RCS file: /home/ncvs/src/etc/defaults/rc.conf,v retrieving revision 1.88 diff -u -d -r1.88 rc.conf --- etc/defaults/rc.conf 2001/01/25 13:05:50 1.88 +++ etc/defaults/rc.conf 2001/01/29 16:17:18 @@ -324,6 +324,8 @@ kern_securelevel_enable="NO" # kernel security level (see init(8)), kern_securelevel="-1" # range: -1..3 ; `-1' is the most insecure update_motd="YES" # update version info in /etc/motd (or NO) +swap_backed_tmp_size="NO" # Size of swapped-backed md(4) /tmp (or NO) +swap_backed_tmp_perm="1777" # Permissions on swapp-backed /tmp start_vinum="" # set to YES to start vinum unaligned_print="YES" # print unaligned access warnings on the alpha (or NO). entropy_file="/entropy" # Set to NO to disable caching entropy through reboots. Index: share/man/man5/rc.conf.5 =================================================================== RCS file: /home/ncvs/src/share/man/man5/rc.conf.5,v retrieving revision 1.89 diff -u -d -r1.89 rc.conf.5 --- share/man/man5/rc.conf.5 2001/01/21 20:57:38 1.89 +++ share/man/man5/rc.conf.5 2001/01/29 16:22:36 @@ -77,6 +77,33 @@ .Ar NO then no swapfile is installed, otherwise the value is used as the full pathname to a file to use for additional swap space. +.It Ar swap_backed_tmp_size +(str) If set to +.Ar NO +then +.Pa /tmp +is left as is. +Otherwise, the value is used as the size of an +swap-backed +.Xr md 4 +disk to create. +Once the disk is created, +it is mounted on +.Pa /tmp . +See +.Xr mdconfig 8 +for legal size values. +.It Ar swap_backed_tmp_perm +(str) If +.Ar swap_backed_tmp_size +is not +.Ar NO +then this value is used to set the +permissions on +.Pa /tmp +once the swap-backed +.Xr md 4 +disk is mounted on it. .It Ar apm_enable (bool) If set to .Ar YES , To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message