From owner-freebsd-questions@freebsd.org Sun Jun 18 08:24:11 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 000BED8BD5D for ; Sun, 18 Jun 2017 08:24:10 +0000 (UTC) (envelope-from list_freebsd@bluerosetech.com) Received: from echo.brtsvcs.net (echo.brtsvcs.net [208.111.40.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E153A6410A for ; Sun, 18 Jun 2017 08:24:10 +0000 (UTC) (envelope-from list_freebsd@bluerosetech.com) Received: from chombo.houseloki.net (unknown [IPv6:2601:1c2:1401:9956:21c:c0ff:fe7f:96ee]) by echo.brtsvcs.net (Postfix) with ESMTPS id BDD5650005; Sun, 18 Jun 2017 08:24:09 +0000 (UTC) Received: from [IPv6:fe80::7102:4df8:1f13:5c55] (unknown [IPv6:fe80::7102:4df8:1f13:5c55]) by chombo.houseloki.net (Postfix) with ESMTPSA id B21F7436; Sun, 18 Jun 2017 01:24:08 -0700 (PDT) Subject: Re: zpool import -N mounts filesystems anyway To: David Christensen , freebsd-questions@freebsd.org References: <7f41df25-df2e-298e-d33e-cc95874e831c@bluerosetech.com> From: Mel Pilgrim Message-ID: Date: Sun, 18 Jun 2017 01:24:15 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jun 2017 08:24:11 -0000 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.