Re: fsck and mount handling in bsd.rd

Previous thread: 團購銷售課程 by service on Wednesday, December 22, 2010 - 1:19 am. (1 message)

Next thread: keynote.{1,3,4,5}: fix IEEE conference name by Lawrence Teo on Wednesday, December 22, 2010 - 7:51 am. (2 messages)
From: Alexander Hall
Date: Wednesday, December 22, 2010 - 2:59 am

As noted by Peter Miller, the fsck and mount procedures in bsd.rd
differ from /etc/rc. Specifically, he had issues with usb disks that
were not always present at boot. While /etc/rc would not fsck
those (since fs_passno == 0) and ignore any issues with mount -a,
the upgrade process was a bit more picky and bailed out.

This diff aims to resolve such situation by doing the following:

- Do not run fsck for fstab entries with zero or empty fs_passno
- Ask for permission to continue upgrade if one or more mounts failed

Testing and OK's wanted.

/Alexander


Index: install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.631
diff -u -p -r1.631 install.sub
--- install.sub	22 Nov 2010 14:10:42 -0000	1.631
+++ install.sub	22 Dec 2010 09:30:53 -0000
@@ -1638,7 +1638,6 @@ install_sets() {
 #	2) mount non-ffs filesystems read only,
 #	3) prepend '/mnt' to all mount points,
 #	4) delete any trailing '/' from the mount point (e.g. root),
-#	5) leave out fs_freq and fs_passno fields.
 #
 # If no /etc/fstab is created, do not proceed with install/upgrade.
 munge_fstab() {
@@ -1666,8 +1665,7 @@ munge_fstab() {
 		# Write fs entry in fstab.
 		# 1) prepend '/mnt' to the mount point.
 		# 2) remove a trailing '/' from the mount point (e.g. root).
-		# 3) leave out fs_freq and fs_passno fields (i.e. $_rest).
-		echo $_dev /mnt${_mp%/} $_fstype $_opt
+		echo $_dev /mnt${_mp%/} $_fstype $_opt $_rest
 
 	done </tmp/fstab >/etc/fstab
 
@@ -1681,28 +1679,27 @@ munge_fstab() {
 # Must mount filesystems manually, one at a time, so we can make
 # sure the mount points exist.
 mount_fs() {
-	local _async=$1 _dev _mp _fstype _opt _rest _err _msg
+	local _async=$1 _dev _mp _fstype _opt _rest _msg _fail
 
 	while read _dev _mp _fstype _opt _rest; do
 		# If not the root filesystem, make sure the mount
 		# point is present.
 		[ "$_mp" = "/mnt" ] || mkdir -p $_mp
 
-		# Mount the filesystem. ...
From: Alexander Hall
Date: Tuesday, January 4, 2011 - 1:25 am

Peter has mailed me explaining he cannot test this until late January.
Any other takers?

Diff updated to match -current. No other changes.

Testing and OK's.

/Alexander


Index: install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.632
diff -u -p -r1.632 install.sub
--- install.sub	3 Jan 2011 00:36:50 -0000	1.632
+++ install.sub	4 Jan 2011 08:24:12 -0000
@@ -1638,7 +1638,6 @@ install_sets() {
 #	2) mount non-ffs filesystems read only,
 #	3) prepend '/mnt' to all mount points,
 #	4) delete any trailing '/' from the mount point (e.g. root),
-#	5) leave out fs_freq and fs_passno fields.
 #
 # If no /etc/fstab is created, do not proceed with install/upgrade.
 munge_fstab() {
@@ -1666,8 +1665,7 @@ munge_fstab() {
 		# Write fs entry in fstab.
 		# 1) prepend '/mnt' to the mount point.
 		# 2) remove a trailing '/' from the mount point (e.g. root).
-		# 3) leave out fs_freq and fs_passno fields (i.e. $_rest).
-		echo $_dev /mnt${_mp%/} $_fstype $_opt
+		echo $_dev /mnt${_mp%/} $_fstype $_opt $_rest
 
 	done </tmp/fstab >/etc/fstab
 
@@ -1681,28 +1679,27 @@ munge_fstab() {
 # Must mount filesystems manually, one at a time, so we can make
 # sure the mount points exist.
 mount_fs() {
-	local _async=$1 _dev _mp _fstype _opt _rest _err _msg
+	local _async=$1 _dev _mp _fstype _opt _rest _msg _fail
 
 	while read _dev _mp _fstype _opt _rest; do
 		# If not the root filesystem, make sure the mount
 		# point is present.
 		[ "$_mp" = "/mnt" ] || mkdir -p $_mp
 
-		# Mount the filesystem. If the mount fails, exit.
-		_msg=$(mount -v -t $_fstype $_async -o $_opt $_dev $_mp)
-		_err=$?
+		# Mount the filesystem. Remember any failure.
+		_msg=$(mount -v -t $_fstype $_async -o $_opt $_dev $_mp) ||
+			_fail="$_fail\n$_mp ($_dev)"
 		echo $_msg | sed -e 's/, ctime=[^,)]*//'
-		if [ $_err != 0 ]; then
-			# In addition to the error message displayed by mount ...
-			cat ...
Previous thread: 團購銷售課程 by service on Wednesday, December 22, 2010 - 1:19 am. (1 message)

Next thread: keynote.{1,3,4,5}: fix IEEE conference name by Lawrence Teo on Wednesday, December 22, 2010 - 7:51 am. (2 messages)