zpool import -N mounts filesystems anyway
Mel Pilgrim
list_freebsd at bluerosetech.com
Sun Jun 18 08:24:11 UTC 2017
On 06/17/2017 20:59, David Christensen wrote:
> On 06/17/17 17:00, Mel Pilgrim wrote:
>> I need to import a pool without mounting its filesystems, but when I use
>> the -N argument to zpool import to, per the man page, "Import the pool
>> without mounting any file systems", it mounts the filesystems anyway.
>>
>> I've tried search for an answer to this, but the question is too
>> ambiguous to get a decent search result.
>>
>> How do I tell ZFS to not mount anything on import?
>
> Which version of FreeBSD?
11.0-RELEASE-p7
The pools and filesystems are all at current feature sets and versions.
> My man 8 zpool shows three forms for import:
>
> zpool import [-d dir | -c cachefile] [-D]
> zpool import [-o mntopts] [-o property=value] ... [-d dir | -c
> cachefile]
> [-D] [-f] [-m] [-N] [-R root] [-F [-n]] -a
> zpool import [-o mntopts] [-o property=value] ... [-d dir | -c
> cachefile]
> [-D] [-f] [-m] [-N] [-R root] [-F [-n]] pool | id [newpool]
>
>
> Only the latter two offer -N.
Both forms that accept -N use it to import without mounting any filesystems.
> It might help if you showed your console session -- exact command, exact
> output.
# zpool list backupA
cannot open 'backupA': no such pool
# zpool import -N backupA
# zpool list backupA
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
backupA 696G 189G 507G - 1% 27% 1.00x ONLINE -
# zfs list backupA
NAME USED AVAIL REFER MOUNTPOINT
backupA 189G 486G 22K /backup-ext/backupA
# zfs get canmount,mountpoint backupA
NAME PROPERTY VALUE SOURCE
backupA canmount on local
backupA mountpoint /backup-ext/backupA local
It appears -N is ignored and the presence of canmount=on and mountpoint
being set results in automatic mounting regardless of whether or not -N
is given to the zpool import command. The expected behaviour is that -N
overrides canmount and mountpoint, leaving all filesystems in the pool
unmounted.
Currently, I work around this by setting mountpoint=none at the root
prior to exporting (all datasets inherit mountpoint). I would prefer to
leave mountpoint set so that the automated task that uses the pools just
has to import and export them without twiddling properties.
More information about the freebsd-questions
mailing list