Re: Cannot mount / from UFS labels

From: Pawel Jakub Dawidek <pjd_at_FreeBSD.org>
Date: Sat, 22 Aug 2009 02:28:22 +0200
On Fri, Aug 21, 2009 at 03:17:23PM +0200, Ulrich Spörlein wrote:
> Hello,
> 
> I'm not sure this ever worked for 7.x but now I need to have the same
> root fs device on two machines: labels to the rescue! As I don't want to
> use the GEOM labels, but UFS labels, this is what I did:
> 
> # tunefs -L root / (in single user)
> then updated /etc/fstab and rebooted

The problem is this: tunefs will write volume name into file system's
superblock on the disk.  Then you remount read-write and UFS will overwrite
superblock with in-memory copy it picked up on first read-only mount (no volume
name in there).  So there will be no volume name in the superblock anymore. You
can confirm that with:

	# tunefs -L root /dev/ad0s1a
	# dumpfs /dev/ad0s1a | grep volname
	There should be volume name here.
	# mount -uw /
	# dumpfs /dev/ad0s1a | grep volname
	No volume name here.

You cannot remount it read-only again and use tunefs again, because this is a
bit of a hack how it works now. Only first read-only mount opens GEOM provider
(eg. /dev/ad0s1a) for reading, but without exclusive bit. Once you remount it
the exclusive bit will be there and you will no longer be able to use tunefs on
this file system.  You can confirm that with:

	# gpart list | grep -A3 'Name: ad0s1a'
	Take a look at the 'e' (exclusive) count.

So what you have to do instead is to boot into single-user mode, put volume
name using tunefs and reboot without remounting the file system. After the
reboot, boot it again into single-user mode, remount it read-write and edit
/etc/fstab. Alternatively for the second single-user mode boot you can change
root provider from loader prompt with this command:

	OK set vfs.root.mountfrom="ufs:/dev/ufs/root"
	OK boot

And once you boot, edit /etc/fstab.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd_at_FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

Received on Fri Aug 21 2009 - 23:01:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:54 UTC