Date: Wed, 31 Oct 2012 14:01:42 -0600 From: John Nielsen <lists@jnielsen.net> To: freebsd-fs@freebsd.org Subject: creating a bootable ZFS image Message-ID: <E89CE323-D4AF-4EF7-855E-2F16E51E71F1@jnielsen.net>
next in thread | raw e-mail | index | archive | help
I am working on a script to create a ZFS-only disk image and install = FreeBSD 9.1-RC2/RELEASE to it for use as a virtual machine template. = Everything works fine up to the point where the image needs to be = detached from the build host. The cleanest (and most logical to me) would be to export the pool on the = build host. Doing so frees the md device and removes the pool from the = build host, which is what I want. Unfortunately the image will not boot, = since the pool is marked inactive. I found a similar thread in 2011 = (subject "Booting from a ZFS pool exported on another system") with a = patch by PJD, but I don't know if that has ever been tested or = committed. (AndI share Kenneth Vestergaard's concern that something else = might need to happen to import the pool once the system boots.) 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. Obviously I need the VM image to be bootable, and ideally I'd like to be = able to run the script multiple times on the build host without changing = the pool name or rebooting every time. Is there a way to make that = happen? Specifically: Is it possible to cleanly offline a zpool without exporting it? If I yank the md device, is there a way to tell zpool to give up = on it without rebooting? Is it possible to boot from an exported filesystem? Thank you, John Nielsen
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E89CE323-D4AF-4EF7-855E-2F16E51E71F1>