XEN/PVH FreeBSD guest (UFS & ZFS) using the installer

freebsd full | freebsd cloud | freebsd ext2fs | freebsd zfs

tested on a Slackware current dom0 (Sep 2020)

Requirements

grab latest release ISO image

mkdir -p /data/ISO-IMAGES/freebsd130/
cd /data/ISO-IMAGES/freebsd130/
wget https://download.freebsd.org/releases/ISO-IMAGES/13.0/FreeBSD-13.0-RELEASE-amd64-disc1.iso
ln -s FreeBSD-13.0-RELEASE-amd64-disc1.iso disc1.iso

Guest vdisk

mkdir -p /data/guests/freebsd/
cd /data/guests/freebsd/
dd if=/dev/zero of=freebsd.img bs=1G count=0 seek=25

Guest skeleton

ls -lhF /data/kernels/freebsd130/boot/kernel/kernel
vi freebsd

kernel = "/data/kernels/freebsd130/boot/kernel/kernel"
type = "pvh"

# booting from install cd first
extra = "vfs.root.mountfrom=cd9660:xbd1"

# then booting from official kernel on UFS
    #extra = "vfs.root.mountfrom=ufs:xbd0s1a"

memory = 7168
name = "freebsd"
vcpus = 3
disk = ['tap:tapdisk:aio:/data/guests/freebsd/freebsd.img,xvda,w',
    'tap:tapdisk:aio:/data/ISO-IMAGES/freebsd130/disc1.iso,xvdb,r']
vif = [ 'bridge=xenbr0, vifname=freebsd.0' ]

Note: no idea why xbd1 won’t show up in kernel’s dmesg while defining xvdb:cdrom in the guest configuration as usual.

Ready to go

xl create freebsd -c

Troubleshooting

Cannot write changes to UFS2 from GNU/Linux without corrupting it

losetup --find --partscan --show freebsd.img
ls -lF /dev/loop*
mount -t ufs -o ufstype=ufs2,rw /dev/loop0p4 lala/
mount -t ufs -o ufstype=ufs2,rw /dev/loop4p4 lala/

gives at startup

Superblock check-hash failed: recorded check-hash 0x4f4ff20c != computed check-hash 0x631ba28f (Ignored)
/: inode 2: check-hash failed
Mounting from ufs:xbd0p4 failed with error 22.

Resources

xen

FreeBSD PVH https://wiki.xen.org/wiki/FreeBSD_PVH

21.8. FreeBSD as a Xen™-Host https://www.freebsd.org/doc/handbook/virtualization-host-xen.html

acpi

https://www.freebsd.org/doc/handbook/acpi-overview.html


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun