Other Root on hammer2

It's in a bhyve guest:
I installed hammer2 by pkg install hammer2.
Then
kldload hammer2
newfs_hammer2 /dev/nda1
mount -t hammer -o hflags=0 /dev/nda1 /mnt

and installed FreeBSD-15.1-RELEASE on /mnt.
I use a separate /boot because the efi loader dose not support hammer2.
It's my /boot/loader.conf
root@anna:~ # cat /mnt/boot/loader.conf
zfs_load="YES"
hammer2_load="YES"
vfs.root.mountfrom="hammer2:/dev/nda1"
vfs.root.mountfrom.options="hflags=0"

But other PFS like /dev/nda1@AAA cannot be mounted in the mountroot phase in this way.
And I'm trying to find a workable method
root@anna:~ # hammer2 stat /
PATH ncp data-use inode-use comp check quota
/ 0 469.22MB 10598 lz4:default xxhash64
root@anna:~ # mount
/dev/nda1 on / (hammer2, local)
devfs on /dev (devfs)
zroot/var/log on /var/log (zfs, local, noatime, noexec, nosuid, nfsv4acls)
zroot/ROOT/test on /mnt (zfs, local, noatime, nfsv4acls)
 
i tried it but it insta panics on write
newfs, mount, pfs-create works but a write will cause a panic
i tried on 14.5 on arm64. im not sure what causes the problem version or arch
 
if i disable lz4 with hammer2(8) works a bit better like it not panics but hangs on umount
seems broken on arm because upgrading to 15.1 did not change anything to the better
 
ok
freebsd kernel will check if the device exists before mounting anything but p9, zfs or nfs so a device spec like /dev/disk@pfs wont work because obviously disk@pfs does not have a node
here is the hack you can do
vfs.root.mountfrom="hammer2:/dev/nda1"
vfs.root.mountfrom.options="hflags=0,from=/dev/nda1@mypfs"
 
1791632338404.png
 
ok
freebsd kernel will check if the device exists before mounting anything but p9, zfs or nfs so a device spec like /dev/disk@pfs wont work because obviously disk@pfs does not have a node
here is the hack you can do
vfs.root.mountfrom="hammer2:/dev/nda1"
vfs.root.mountfrom.options="hflags=0,from=/dev/nda1@mypfs"
Thanks, so that’s possible too. Actually, I modified sys/kern/vfs_mountroot.c and added strcmp(fs, "hammer2") == 0 || after zfs, nfs and p9fs that don’t need to be checked, and recompiled the kernel.
 
its about 5000 calls to something like lz4xxx64klmitedoutput. after i set lz4 to off it works a bit better. the backtrace is not really useful. so the stack seems borked because the function itself is not recursive
 
Back
Top