freebsd full | freebsd cloud | freebsd ext2fs | freebsd zfs
tested on debian and slack150
we need a specific EXT2FS-enabled kernel
grab latest base tarball
mkdir -p /data/kernels/freebsd132/ cd /data/kernels/freebsd132/ wget https://download.freebsd.org/releases/amd64/amd64/13.2-RELEASE/base.txz
for userland it’s better to use bsdtar
# ubuntu apt install libarchive-tools # slackware slackpkg install libarchive
mkdir -p /data_local/guests/freebsd-ext2fs/lala/ cd /data_local/guests/freebsd-ext2fs/ dd if=/dev/zero of=freebsd-ext2fs.ext2 bs=1G count=0 seek=10 mkfs.ext2 freebsd-ext2fs.ext2 mount freebsd-ext2fs.ext2 lala/
bsdtar -xJ --numeric-owner -f /data/kernels/freebsd132/base.txz -C lala/ ls -lhF lala/ du -sh lala/
right onto the slice w/o BSD partition a
vi lala/etc/fstab # new file # need to install e2fsck, no fsck meanwhile /dev/xbd0 / ext2fs rw,noatime 0 0
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/
mkdir -p /data/guests/freebsd-ext2fs/ cd /data/guests/freebsd-ext2fs/ vi freebsd-ext2fs # +EXT2FS + PF kernel = "/data/kernels/freebsd132/minimal-ext2fs" extra = "vfs.root.mountfrom=ext2fs:/dev/xbd0" type = "pvh" name = "freebsd-ext2fs" vcpus = 3 memory = 7168 disk = [ 'tap:tapdisk:aio:/data_local/guests/freebsd-ext2fs/freebsd-ext2fs.ext2,xvda,w' ] #disk = [ 'phy:/dev/drbd/by-res/fcarp1/0,xvda,w' ] vif = [ 'bridge=guestbr0, vifname=ext2fs.0', 'bridge=guestbr0, vifname=ext2fs.1' ]
fsck.ext2 /data_local/guests/freebsd-ext2fs/freebsd-ext2fs.ext2 -f xl create freebsd-ext2fs -c
ping -c1 opendns.com pkg install e2fsprogs which fsck_ext2fs vi /etc/fstab /dev/xbd0 / ext2fs rw,noatime 0 1
one could otherwise consider making a partition on the vdisk
dd if=/dev/zero of=freebsd-ext2fs.img bs=1G count=0 seek=10 fdisk freebsd-ext2fs.img n p ENTER ENTER ENTER a t a5 w losetup --list losetup --detach-all losetup --find --partscan --show freebsd-ext2fs.img mkfs.ext2 /dev/loop0p1 mount /dev/loop0p1 lala/
/dev/xbd0s1 / ext2fs rw 0 0 /dev/xbd0s1 / ext2fs rw 0 1
extra = "vfs.root.mountfrom=ext2fs:/dev/xbd0s1" disk = ['tap:tapdisk:aio:/data_local/guests/freebsd-ext2fs/freebsd-ext2fs.img,xvda,w']
one could also consider loading the module from loader.conf (untested)
ext2fs_load=YES
fsck: exec fsck_ext2fs for /dev/xbd0s1 in /sbin:/usr/sbin: No such file or directory
==> install e2fsprogs
ext2fs – ext2/ext3/ext4 file system https://www.freebsd.org/cgi/man.cgi?query=ext2fs
https://wiki.freebsd.org/Ext2fs
https://www.freebsd.org/cgi/man.cgi?loader(8)
https://docs.freebsd.org/en/books/handbook/kernelconfig/
https://leaf.dragonflybsd.org/mailarchive/users/2010-07/msg00036.html –> initrd
https://www.unitedbsd.com/d/327-how-to-properly-mount-linux-partitions-on-zfs-root-of-ghostbsd/3
https://www.vcdx200.com/2013/12/freebsd-running-from-read-only-compact.html
https://docs.freebsd.org/en/books/handbook/serialcomms/
https://lists.freebsd.org/pipermail/freebsd-questions/2009-August/204350.html