From lonewolf@helios.earthmagic.org  Sat Sep 21 05:51:13 2002
Return-Path: <lonewolf@helios.earthmagic.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 707F337B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Sep 2002 05:51:13 -0700 (PDT)
Received: from helios.earthmagic.org (helios.earthmagic.org [198.78.66.220])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2518443E3B
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Sep 2002 05:51:13 -0700 (PDT)
	(envelope-from lonewolf@helios.earthmagic.org)
Received: (qmail 44274 invoked by uid 1001); 21 Sep 2002 12:51:04 -0000
Message-Id: <20020921125104.44273.qmail@helios.earthmagic.org>
Date: 21 Sep 2002 12:51:04 -0000
From: lonewolf@earthmagic.org
Reply-To: lonewolf@earthmagic.org
To: FreeBSD-gnats-submit@freebsd.org
Cc: lonewolf@earthmagic.org
Subject: Ability to have vnode based file systems mounted on boot
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         43167
>Category:       conf
>Synopsis:       Ability to have vnode based file systems mounted on boot
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 21 06:00:15 PDT 2002
>Closed-Date:    Sun Jun 19 17:48:57 GMT 2005
>Last-Modified:  Sun Jun 19 17:48:57 GMT 2005
>Originator:     Johny Mattsson
>Release:        FreeBSD 4.7-RC i386
>Organization:
earthmagic.org
>Environment:
System: FreeBSD tank.zone2.earthmagic.org 4.7-RC FreeBSD 4.7-RC #2: Sat Sep 21 17:28:54 EST 2002 root@sarah.zone2.earthmagic.org:/usr/obj/usr/src/sys/TANK i386

	
>Description:
While vn(4) based file systems offer great flexibility, the option to
mount such filesystem on boot is currently missing. There is no way of
getting vnconfig(8) to run in time to make the vn's available for mounting.
This is a shame as I needed/wanted that functionality today.

So I added it :)

I'm hoping you'll find this to be a useful addition to include in future
releases, or if nothing else, an inspiration for something even better.

	
>How-To-Repeat:
Well.. just try and stick a /dev/vn0c line in your /etc/fstab and you'll
see how far you get on mounting that one at boot time. Which is to say
nowhere at all.
	
>Fix:
I've tweaked /etc/rc and added two knobs to /etc/default/rc.conf to
provide the mechanism for running vnconfig(8), fsck:ing the fs'es,
and mounting them at boot time.

I'm not 100% the place in /etc/rc where I added it is the most optimal,
but it needs to be somewhere after having had NFS fs'es mounted (in case
the fs file is located on an NFS mount), and before starting up our own
nfsd (if we're sharing a "vn-fs"). As I put it, it's right before
network_pass2 gets invoked. It could possibly be moved to even earlier,
especially if we want to use it as /tmp and want it to be cleared on boot.
Not that I see much use for it, but maybe someone else might. I guess
right after the NFS mounts would be an okay location as well.

Cheers,
/Johny

Diffs inline below:

--- rc.old	Sat Sep 21 22:36:29 2002
+++ rc	Sat Sep 21 23:06:35 2002
@@ -422,6 +422,28 @@
 	fi
 fi
 
+# Set up vnconfig's and mount vnode based file systems
+#
+case "${vnmount_enable}" in
+[Yy][Ee][Ss])
+	echo -n 'Configuring vnodes:'
+	vnconfig -a -f "${vnmount_tab}"
+	echo ' done.'
+	echo 'Automatic vnode based file systems checks:'
+	grep '^/dev/vn' /etc/fstab | awk '{print $1}' | while read device
+	do
+		fsck -p "$device"
+	done
+	echo -n 'Mounting vnode based file systems:'
+	grep '^/dev/vn' /etc/fstab | awk '{print $2}' | while read mountpoint
+	do
+		echo -n " $mountpoint"
+		mount "$mountpoint"
+	done
+	echo '.'
+	;;
+esac
+
 if [ -n "${network_pass1_done}" ]; then
 	network_pass2
 fi
	




--- defaults/rc.conf.old	Sat Sep 21 22:39:22 2002
+++ defaults/rc.conf	Sat Sep 21 22:52:31 2002
@@ -375,6 +375,11 @@
 update_motd="YES"	# update version info in /etc/motd (or NO)
 start_vinum="NO"	# set to YES to start vinum
 unaligned_print="YES"	# print unaligned access warnings on the alpha (or NO).
+vnmount_enable="NO"	# Enable automatic mounting of vn(4) based file systems.
+vnmount_tab="/etc/vntab"
+			# Config file for vnconfig(8) (if vnmount is enabled).
+			# File systems must be listed in /etc/fstab with the
+			# "noauto" option to make them mount properly.
 
 ##############################################################
 ### Define source_rc_confs, the mechanism used by /etc/rc.* ##


	
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: matteo 
State-Changed-When: Sun Jun 19 17:47:07 GMT 2005 
State-Changed-Why:  
this is already possible using md(4) entries in fstab: 
md     /mnt    mfs     rw,-F/usr/tmp/md.fs     0       0 
See mount_mfs(8) for additional info. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43167 
>Unformatted:
