From owner-freebsd-current@freebsd.org Fri May 7 16:47:59 2021 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01BD6634E65 for ; Fri, 7 May 2021 16:47:59 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from tor1-11.mx.scaleengine.net (tor1-11.mx.scaleengine.net [IPv6:2001:470:1:474::25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcGbL57s2z4qg6 for ; Fri, 7 May 2021 16:47:58 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.3] (senat1-01.HML3.ScaleEngine.net [209.51.186.5]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by tor1-11.mx.scaleengine.net (Postfix) with ESMTPSA id 7D2EB24BDA for ; Fri, 7 May 2021 16:47:52 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 tor1-11.mx.scaleengine.net 7D2EB24BDA Subject: Re: Building ZFS-based VM images To: freebsd-current@freebsd.org References: From: Allan Jude Message-ID: <5f5f9d31-29b7-1520-55fa-216e24e6132a@freebsd.org> Date: Fri, 7 May 2021 12:47:51 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4FcGbL57s2z4qg6 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2021 16:47:59 -0000 On 5/6/2021 11:17 AM, Alan Somers wrote: > It's easy to build a UFS-based VM image just by setting WITH_VMIMAGES in > release.conf and running release.sh. But what about ZFS-based images? > What's the easiest way to build a ZFS-based VM image, using a pool layout > similar to what the interactive installer uses? > -Alan > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" > With the new scripting support, it is fairly easy with poudriere-image It also has the advantage of being able to build the images from poudriere jails you already have (or can build from FTP without compiling). The pre/post build script stuff is merged already, although my example scripts are in a different pull request that I need to rebase around some restructuring first. Anyway, you can use poudriere-image with the pre/post scripts included here: https://github.com/freebsd/poudriere/pull/731/files#diff-6607907a033a4e5e5e21da56960ed7ccbfb6dd4a85d66615553d2221d75c0998 and it will make a VM image with the same layout as if you had used the installer (or you can customize it as you see fit) I'm currently using this to build images for AWS and bhyve, but also to generate installer ISOs that run a script to format the drives and create the zpool, then 'fetch -o - url | zfs recv -F zroot' to install a replication stream of an entire pool. For upgrades, we do the same but only replace the boot environment. -- Allan Jude