Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Nov 2012 14:54:21 -0600
From:      John Nielsen <lists@jnielsen.net>
To:        freebsd-fs@freebsd.org
Subject:   Re: creating a bootable ZFS image
Message-ID:  <F69BE9DA-589E-4961-A9A5-B21CA752A3EE@jnielsen.net>
In-Reply-To: <20121031233007.57aea90b@fabiankeil.de>
References:  <E89CE323-D4AF-4EF7-855E-2F16E51E71F1@jnielsen.net> <20121031233007.57aea90b@fabiankeil.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Oct 31, 2012, at 4:30 PM, Fabian Keil <freebsd-listen@fabiankeil.de> =
wrote:

> John Nielsen <lists@jnielsen.net> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F69BE9DA-589E-4961-A9A5-B21CA752A3EE>