[DragonFlyBSD - Bug #3202] (Resolved) Cannot boot from HAMMER2

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Sun Jan 2 17:05:25 PST 2022

Issue #3202 has been updated by liweitianux.

Status changed from New to Resolved
% Done changed from 0 to 100

A modified patch pushed to master in commits d7e11471bd451b05672ba37334898eaa52f35415 and 2ad4d0e44d46f6fc8f0a772fce2898c8b8f896c8 by Matt.

Bug #3202: Cannot boot from HAMMER2

* Author: mneumann
* Status: Resolved
* Priority: Normal
* Category: Kernel
* Target version: 6.2
* Start date: 2019-08-30
Booting from HAMMER2 "BOOT" PFS works when created via "newfs_hammer2 -L BOOT".

But when I use "hammer2 pfs-create BOOT", I got the message "hammer2: 'BOOT' PFS not found".
I might have created and deleted the "BOOT" PFS multiple times on that file system.

My BOOT PFS inode number is "0xd9b36ce135528001", but HAMMER2_BOOT_KEY is defined as "0xd9b36ce135528000".
With the following patch I can successfully boot from HAMMER2:

--- a/lib/libstand/hammer2.c
+++ b/lib/libstand/hammer2.c
@@ -692,7 +692,7 @@ h2init(struct hammer2_fs *hfs)
        h2lookup(hfs, NULL, 0, 0, NULL, NULL);
        r = h2lookup(hfs, &hfs->sroot,
-                    HAMMER2_BOOT_KEY, HAMMER2_BOOT_KEY,
+                    HAMMER2_BOOT_KEY, HAMMER2_BOOT_KEY | 0xFFFFU,
                     &hfs->sroot, &data);
        if (r <= 0) {
                printf("hammer2: 'BOOT' PFS not found\n");

I am not sure if this is 100% the right approach.
I would rather like to check for the name explicitly as there can be hash collisions.

To successfully boot from HAMMER2, I have to "set currdev="disk0s1d" and then 
"cd /kernel" and then follow normal boot procedure (loadall, boot).

To really be useful, one would have to allow other PFSes than "BOOT" to be booted from,
so that you can boot from a snapshot for instance.

You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account

More information about the Bugs mailing list