Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jun 2017 01:24:15 -0700
From:      Mel Pilgrim <list_freebsd@bluerosetech.com>
To:        David Christensen <dpchrist@holgerdanske.com>, freebsd-questions@freebsd.org
Subject:   Re: zpool import -N mounts filesystems anyway
Message-ID:  <d4b055f2-2273-6df8-fe55-640f3b56e04d@bluerosetech.com>
In-Reply-To: <eb778163-8387-fd55-8e8f-d65ec221e6e8@holgerdanske.com>
References:  <7f41df25-df2e-298e-d33e-cc95874e831c@bluerosetech.com> <eb778163-8387-fd55-8e8f-d65ec221e6e8@holgerdanske.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d4b055f2-2273-6df8-fe55-640f3b56e04d>