bin/181847: zpool sets wrong mountpoint when using altroot

ShelLuser pl at catslair.org
Thu Sep 5 18:50:00 UTC 2013


>Number:         181847
>Category:       bin
>Synopsis:       zpool sets wrong mountpoint when using altroot
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 05 18:50:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     ShelLuser
>Release:        9.2-RC3
>Organization:
>Environment:
FreeBSD fbsd.intranet.lan 9.2-RC3 FreeBSD 9.2-RC3 #0 r254795: Sun Aug 25 00:42:01 UTC 2013   root at bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC   i306

>Description:
Being curious I downloaded FreeBSD-9.2-RC3-i386-bootonly, setup a FreeBSD virtual machine using VirtualBox 4.2.16 and then followed the procedure explained here to setup a ZFS only system:

http://forums.freebsd.org/showthread.php?t=31557

I've followed this procedure several times on FreeBSD 9.1-RELEASE and can confirm that it works.

However, when I try to create the ZFS pool the command now complains that it cannot create the mount point:

# zpool create -f -o altroot=/mnt -o cachefile=/var/tmp/zpool.cache zroot /dev/gpt/disk0
cannot mount '/mnt/zroot': failed to create mountpoint

Which I think is not the way it's suppose to behave. When looking at the current ZFS filesystem you'll notice that it tried to mount the filesystem on /zroot instead of / :

# zfs list -o name,mountpoint
NAME   MOUNTPOINT
zroot  /mnt/zroot

The reason why I think this to be incorrect: by default (so without using -R) the mountpoint for a new pool is /pool (where 'pool' is the name of the pool itself). But if you specify a different mountpoint wouldn't it make more sense that it replaces the default mountpoint instead of being prepended to it? At least when you're using zpool instead of zfs.

This is also mentioned in the zpool manualpage under the 'create' option (I quote):

"Unless the -R option is specified, the default mount point is
 "/pool".  The mount point must not exist or must be empty, or else
 the root dataset cannot be mounted. This can be overridden with the
-m option."

I wasn't sure if I should report it, but because the behaviour of zpool changed so drastically I figured I'd better do so anyway, at the risk that this behaviour is intended. (I did not write this PR on a whim).

>How-To-Repeat:
Install FreeBSD as normal and follow the instructions in this thread:

http://forums.freebsd.org/showthread.php?t=31557

Or simply create a new ZFS pool and specify an altroot, either using -o altroot=/altroot or by using -R /altroot.

Previously the newly created filesystem would get assigned to / as the mountpoint, now it always uses the default mountpoint.

>Fix:
# zpool create -R /mnt -m / zroot /dev/gpt/disk0

Instead of the previously mentioned:

# zpool create -R /mnt zroot /dev/gpt/disk0

Or if you already experienced the error message then the previous behaviour can be achieved by changing the mountpoint for the newly created filesystem to /.

# zfs set mountpoint=/ zroot


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list