Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jan 2001 18:23:44 +0200
From:      Sheldon Hearn <sheldonh@uunet.co.za>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        mjacob@feral.com, Matt Dillon <dillon@earth.backplane.com>, John Baldwin <jhb@freebsd.org>, cvs-all@freebsd.org, cvs-committers@freebsd.org, Mikhail Teterin <mi@aldan.algebra.com>
Subject:   Re: workaround for broken mfs using vn. (was Re: cvs commit: src/sys/i386/conf GENERIC ) 
Message-ID:  <625.980785424@axl.fw.uunet.co.za>
In-Reply-To: Your message of "Mon, 29 Jan 2001 15:21:21 %2B0100." <21404.980778081@critter> 

next in thread | previous in thread | raw e-mail | index | archive | help


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?625.980785424>