From owner-freebsd-current Sun Mar 11 13:18: 2 2001 Delivered-To: freebsd-current@freebsd.org Received: from bunrab.catwhisker.org (adsl-63-193-123-122.dsl.snfc21.pacbell.net [63.193.123.122]) by hub.freebsd.org (Postfix) with ESMTP id 05F4F37B719 for ; Sun, 11 Mar 2001 13:17:59 -0800 (PST) (envelope-from david@catwhisker.org) Received: (from david@localhost) by bunrab.catwhisker.org (8.10.0/8.10.0) id f2BLHw561727 for current@freebsd.org; Sun, 11 Mar 2001 13:17:58 -0800 (PST) Date: Sun, 11 Mar 2001 13:17:58 -0800 (PST) From: David Wolfskill Message-Id: <200103112117.f2BLHw561727@bunrab.catwhisker.org> To: current@freebsd.org Subject: swap-backed md-based /tmp to replace mfs-based one Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG During the past week, I've been tracking -STABLE (daily) & -CURRENT (about 2 days out of 3) on a new laptop. (More stuff about that in the recent -mobile archives, for folks who might have an interest.) Although I realize that there are significant differences between the FreeBSD mfs vs. the Sun tmpfs, using an mfs-based, swap-backed /tmp has generally been working well for me over the last 3 years of using FreeBSD. (I tend to be generous with swap diskspace allocations, which helps.) And on this laptop, I have 3 different bootable "root" (& associated /usr) partitions, so I can run -CURRENT, as well as run either of a couple of -STABLEs. But since I'm running no more than one at a time, it made sense to me to have the swap space be common to all three environments, and to make /tmp be swap-backed. In -STABLE, I merely stuffed an appropriate entry in /etc/fstab, and It Just Worked. However, based on the example in the mdconfig man page on -CURRENT, I get the impression that the process is a little more involved. Accordingly, I created the following shell script to accomplish a similar objective, based upon the above-mentioned example in the mdconfig man page. At present, I have it sitting in /usr/local/etc/rc.d, which isn't ideal, but I wanted to find out if anyone had better approaches for doing this, suggestions for improvement, or arguments that what I'm trying to do is misguided and shouldn't be done: #!/bin/sh size=512M # Plugged directly in to the mdconfig command, # so use an expression that's compatible with that. case "$1" in start) # Taken from the mdconfig man page, then lightly hacked: # To create and mount a 128MByte swap backed filesystem on /tmp: if [ -x /sbin/mdconfig ]; then /sbin/mdconfig -a -t swap -s $size -u 10 && \ /sbin/disklabel -r -w md10 auto && \ /sbin/newfs /dev/md10c && \ /sbin/tunefs -n enable /dev/md10c && \ /sbin/mount /dev/md10c /tmp && \ /bin/chmod 1777 /tmp && \ exit 0 fi ;; stop) dev=`/sbin/mount | /usr/bin/awk '/ \/tmp / {print $1}'` || exit 1 /sbin/umount /tmp && [ -c $dev ] && /sbin/mdconfig -d -u $dev exit 0 ;; *) echo "Usage: `basename $0` {start|stop}" >&2 ;; esac exit 2 Thanks, david -- David H. Wolfskill david@catwhisker.org As a computing professional, I believe it would be unethical for me to advise, recommend, or support the use (save possibly for personal amusement) of any product that is or depends on any Microsoft product. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message