Creating an Alpine Linux VM on Bhyve - With Root on ZFS (Optionally Encrypted)
![/featured/alps.webp](/featured/alps.webp)
Bhyve is great - and we’re using it with a lot of guest operating systems.
One of my favourite Linux distributions is Alpine Linux - it’s great as a docker or lxc/lxd host, is light, stable and easily manageable.
On FreeBSD, vm-bhyve already provides a good template for Alpine Linux, but it’s based on the plain standard image with boot on ext4.
So we need the alpine-extended iso - with zfs module.
Let’s create a new Alpine Linux bhyve VM:
vm create -t alpine -s 50G -m 4G -c 2 alpinevm
Now let’s configure it:
vm configure alpinevm
Let’s change some options: vmlinuz-vanilla and initramfs-vanilla should be changed to vmlinuz-lts and initramfs-lts.
More, we should instruct grub to boot from ZFS. The configuration should be similar to this:
|
|
It’s now time to start with the installation:
vm install alpinevm alpine-extended.iso
Now, follow this Alpine Linux Wiki guide. Remember that we’re dealing with “vda” devices, not “sda”, so change them accordingly. If you don’t want to have an encrypted rootfs dataset, just avoid the encryption line in the zpool create command.
At the end of the installation procedure, reboot and enjoy your new Alpine Linux bhyve VM.
Related Content
- Why We're Migrating (Many Of) Our Servers From Linux to FreeBSD
- How We Are Migrating (Many Of) Our Servers From Linux to FreeBSD - Part 2 - Backups and Disaster Recovery
- Alpine Linux and LXD Perfect Setup on BTRFS File System
- How We Are Migrating (Many Of) Our Servers From Linux to FreeBSD - Part 1 - System and Jails Setup
- FreeBSD, Caddy and PHP - A Perfect Match