$ virt-builder -l | grep fedora-25 fedora-25 x86_64 Fedora® 25 Server fedora-25 i686 Fedora® 25 Server (i686) fedora-25 aarch64 Fedora® 25 Server (aarch64) fedora-25 armv7l Fedora® 25 Server (armv7l) fedora-25 ppc64 Fedora® 25 Server (ppc64) fedora-25 ppc64le Fedora® 25 Server (ppc64le)
$ virt-builder fedora-25 $ qemu-system-x86_64 -machine accel=kvm:tcg \ -cpu host -m 2048 \ -drive file=fedora-25.img,format=raw,if=virtio
Or to try out Fedora on a different architecture:
$ virt-builder fedora-25 --arch ppc64le -o fedora-25-ppc64le.img $ qemu-system-ppc64 -cpu POWER8 -m 2048 \ -drive file=fedora-25-ppc64le.img,format=raw,if=virtio
Thanks Rich! My only complaint with virt-builder, and I hope I’m wrong on this, is that you can’t really control how big the swap partition is. Please say there is some way to specify swap partition size!?! While I’m sure there is a way to manipulate the resulting disk image with various tools after-the-fact, that really negates the speed and ease of use of virt-builder.
We always say that virt-builder is just a wrapper around lower-level tools. The
--size
parameter really runs virt-resize. If you’re prepared to do the virt-resize step yourself as an extra step then you can control the swap partition size (or indeed other partitions).However doing that did reveal a bug: virt-resize does not adjust the size of the swap partition data, so when you boot the guest the first time you have to:
to get the extra space. This is a bug in virt-resize, so you can file that in the usual way.
I don’t have a usual way with regards to virt-resize as I’ve not filed a bug on it before. I have worked with bugzilla.redhat.com a ton… but are you talking about a libguestfs specific bug site?
Yes, since virt-builder is a wrapper to underlying tools, can’t you tell those tools what size you want the swap partition to be initially? Thanks for showing the various steps it takes to change it after-the-fact… but again, that really negates the speed and ease-of-use of virt-builder to begin with. virt-builder does have a way to specify initial disk size but when you make a huge disk and it by default has a tiny swap… I mean… who wants that? I guess just asking about the swap partition really is a cop-out on my part… as really, you’d want a way to enumerate all desired partitions and not just swap. Maybe there is an easy enough way to make a blank disk image sized and partitioned exactly as desired prior to running virt-builder and then a way to tell virt-builder to use that as a base?
I guess once I play with your recipe a few times and better learn the disk manipulation tools, I’ll feel differently… but imagine all of the effort it takes just to adjust the swap and then what about the other partitions? Starts to sound like a nightmare or do you disagree?
Pino has posted a fix for the virt-resize bug that I mentioned above: https://www.redhat.com/archives/libguestfs/2016-November/msg00122.html
virt-builder works by resizing an existing template, and indeed it by default does not resize the swap partition of the existing template. This could well be a useful thing for virt-builder to do, so probably best to follow the RFE procedure (http://libguestfs.org/guestfs-faq.1.html#how-do-i-propose-a-feature). BTW using virt-resize separately won’t be any slower, although it is obviously a lot more clumsy unless you surround it with some more scripting.
Pingback: Fedora on the Pine64 | Richard WM Jones