ZFS: inherited mountpoints with root filesystem

Pawel Jakub Dawidek pjd at FreeBSD.org
Fri Apr 27 09:04:53 UTC 2007


On Thu, Apr 26, 2007 at 03:52:05PM -0500, Barry Pederson wrote:
> Pawel Jakub Dawidek wrote:
> >On Wed, Apr 25, 2007 at 09:29:47AM -0500, Barry Pederson wrote:
> >>Is this double-mountpoint setup the way things should be?  If so, is/can there be an option to have the ZFS-mountpoint for a root-mounted filesystem also be "/", so that 
> >>inherited mountpoints for sub-filesystems are under "/" instead of "/<pool-name>"?
> >For file systems that are mounted not via 'zfs mount -a' (eg. they are
> >mounted by hand or via /etc/fstab), you should set mountpoint property
> >to 'legacy'.
> 
> So you're saying that if you're doing vfs.root.mountfrom="zfs:tank" in loader.conf, then tank's mountpoint should be "legacy"?
> 
> I'm trying that now, but the drawback there is that the sub-filesystems like "tank/home" also inherit that "legacy" mountpoint, so they have to be manually listed in 
> /etc/fstab.  That seems to carry on down to sub-sub filesystems like "tank/home/bob" and so on.  So you lose out on the nice auto-mounting feature in ZFS.
> 
> I was hoping that booting with vfs.root.mountfrom="zfs:tank" would be equivalent to something like:
> 
> 	zpool import -R /
> 
> I wonder now if it wouldn't have been better to have created the pool as an Alternate Root Pool in the first place.
> 
> Is there a way to change an existing pool's mountpoint to '/' like an Alternate Root pool?  A simple "zfs set mountpoint=/" doesn't fly because it wants to unmount root to 
> do it.  I'd kind of need to change it, but not have it take effect immediately.

But the thing is that root file system is mounted by the kernel
automatically and such file systems should define mountpoint as
'legacy'. You can still set mountpoint for tank/home to /usr/home/ and
then all children of tank/home will inherit it.

You could also try setting tank mountpoint to /, but after setting
canmount property to 'off'. This may not work, because ZFS may want to
unmount tank automatically.

What I prefer the most, is to don't touch root dataset at all, just keep
it around unmounted as a head for others datasets, eg.

	# zpool create tank da0
	# zfs set canmount=off tank
	# zfs set mountpoint=legacy tank
	# zfs create tank/root	# this will be mounted as / by the kernel
	# zfs create tank/usr
	# zfs set mountpoint=/usr tank/usr

etc.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20070427/dddd56ba/attachment.pgp


More information about the freebsd-fs mailing list