freebsd full | freebsd cloud | freebsd ext2fs | freebsd zfs
grab latest cloud image
cd /data_local/ wget https://download.freebsd.org/snapshots/VM-IMAGES/13.2-STABLE/amd64/Latest/FreeBSD-13.2-STABLE-amd64.raw.xz unxz FreeBSD-13.2-STABLE-amd64.raw.xz
prepare PVH kernel
mkdir /data/kernels/freebsd132/ cd /data/kernels/freebsd132/ wget https://download.freebsd.org/snapshots/amd64/13.2-STABLE/kernel.txz tar xaf kernel.txz rm -f kernel.txz
you might want some space to re-build the kernel also
dd if=/dev/zero of=freebsd_usr_src.img bs=1G count=0 seek=25
we need to fix the serial console and disable DHCP from the cloud image
losetup --find --show FreeBSD-13.2-STABLE-amd64.raw partprobe /dev/loop0 mkdir lala/ mount -t ufs -o ufstype=ufs2 /dev/loop0p4 lala/
fix the serial console
mv -i lala/etc/ttys lala/etc/ttys.dist vi lala/etc/ttys xc0 "/usr/libexec/getty Pc" xterm onifexists secure
vi lala/etc/rc.conf hostname="freebsd.localdomain" # esp. required for the cloud image growfs_enable="YES" ifconfig_xn0="inet CIDR up" defaultrouter="GW-IP" sshd_enable=yes mv lala/etc/ssh/sshd_config lala/etc/ssh/sshd_config.dist grep -vE '^#|^$' lala/etc/ssh/sshd_config.dist > lala/etc/ssh/sshd_config echo permitrootlogin prohibit-password >> lala/etc/ssh/sshd_config mkdir lala/root/.ssh/ cat ~/.ssh/*pub vi lala/root/.ssh/authorized_keys (paste your pub key) chmod 600 lala/root/.ssh/authorized_keys chmod 700 lala/root/.ssh/ chmod 700 lala/root/ mv -i lala/etc/hosts lala/etc/hosts.dist vi lala/etc/hosts 127.0.0.1 localhost.localdomain localhost ::1 localhost.localdomain localhost 10.1.0.9 freebsd.localdomain freebsd vi lala/etc/resolv.conf nameserver 10.1.255.19 nameserver 10.1.255.20
ls -lF lala/etc/localtime ln -s ../usr/share/zoneinfo/Europe/Moscow lala/etc/localtime
umount lala/ rmdir lala/
notice we will need to mount GPT partition 4
fdisk -l /data_local/FreeBSD-13.2-STABLE-amd64.raw mkdir -p /data/guests/freebsd/ cd /data/guests/freebsd/ vi freebsd # generic / pvh for UFS kernel = "/data/kernels/freebsd132/boot/kernel/kernel" extra = "vfs.root.mountfrom=ufs:xbd0p4" type = "pvh" memory = 7168 name = "freebsd" vcpus = 3 disk = [ 'tap:tapdisk:aio:/data_local/FreeBSD-13.2-STABLE-amd64.raw,xvda,w', 'tap:tapdisk:aio:/data_local/freebsd_usr_src.img,xvdb,w' ] vif = [ 'bridge=guestbr0, vifname=freebsd.0', 'bridge=guestbr0, vifname=freebsd.1' ]
xl create freebsd -c
eventually prepare that additional space there
newfs /dev/xbd1 touch /usr/src/UFS_NOT_MOUNTED cp -pi /etc/fstab /etc/fstab.dist vi /etc/fstab /dev/xbd1 /usr/src ufs rw 0 2 mount /usr/src/