From owner-freebsd-fs@FreeBSD.ORG Thu Nov 1 20:54:23 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0AB23A64 for ; Thu, 1 Nov 2012 20:54:23 +0000 (UTC) (envelope-from lists@jnielsen.net) Received: from ns1.jnielsen.net (secure.freebsdsolutions.net [69.55.234.48]) by mx1.freebsd.org (Postfix) with ESMTP id C26598FC0A for ; Thu, 1 Nov 2012 20:54:22 +0000 (UTC) Received: from [10.10.1.32] (office.betterlinux.com [199.58.199.60]) (authenticated bits=0) by ns1.jnielsen.net (8.14.4/8.14.4) with ESMTP id qA1KsJox088986 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Thu, 1 Nov 2012 16:54:19 -0400 (EDT) (envelope-from lists@jnielsen.net) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: creating a bootable ZFS image From: John Nielsen In-Reply-To: <20121031233007.57aea90b@fabiankeil.de> Date: Thu, 1 Nov 2012 14:54:21 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20121031233007.57aea90b@fabiankeil.de> To: freebsd-fs@freebsd.org X-Mailer: Apple Mail (2.1499) X-DCC-x.dcc-servers-Metrics: ns1.jnielsen.net 104; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: clamav-milter 0.97.5 at ns1.jnielsen.net X-Virus-Status: Clean X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2012 20:54:23 -0000 On Oct 31, 2012, at 4:30 PM, Fabian Keil = wrote: > John Nielsen wrote: >=20 >> What I am doing instead is creating the pool with -o = failmode=3Dcontinue, >> installing, unmounting everything, then forcibly detaching the md >> device. This gives me an image I can use, and it boots and runs fine. >> Unfortunately, that leaves me with a defunct pool on the build host >> until I reboot it. Anything I try to do to the pool (destroy, = offline, >> export, etc) returns "cannot open 'zfsroot': pool I/O is currently >> suspended." (With the default failmode=3Dwait, it's even worse since = any >> command that tries to touch the pool never returns.) The pool state = is >> "UNAVAIL" and the device state is "REMOVED". Once the build host is >> rebooted the device state changes to UNAVAIL and zpool destroy works = as >> expected. >=20 > Did you try "zpool clear [-F] $pool" after reattaching the md? >=20 > It often works for me in situations where other zpool subcommands > just hang like you described above. Thanks for the response. I haven't tried that since I don't want to = reattach [a copy of] the md if I don't have to. However, this suggestion = prompted me to come up with the following, which will work until = something better comes along. It takes advantage of ZFS on the build = host to make a temporary snapshot of the zfs where the image file is = located. Could also be adapted to use a zvol instead of an image file. # zfs unmount imageroot (and its children) ... modify mount points, etc for target ... # zfs snapshot buildhostpool/images@mkimage_tmp # zpool destroy imageroot # md config -d -u ${MD} # zfs rollback buildhostpool/images@mkimage_tmp # zfs destroy buildhostpool/images@mkimage_tmp No orphaned zpool or busy md device on the build host, but all the bits = are still intact on the image after rolling back the snapshot. Thanks, JN