The bsdlabel utility is deprecated, and gpart should be used instead:
Offset the first 16 sectors, just like bsdlabel did (used for metadata).
Differential D47653
nanobsd: Remove dependency on bsdlabel jlduran on Mon, Nov 18, 12:29 AM. Authored by Tags None Referenced Files
Subscribers None
Details
The bsdlabel utility is deprecated, and gpart should be used instead: Offset the first 16 sectors, just like bsdlabel did (used for metadata). Verify gpart producess the same results: md0=$(mdconfig -s 100m) md1=$(mdconfig -s 100m) bsdlabel -w "$md0" gpart create -s bsd "$md1" gpart add -t '!0' -b 16 "$md1" gpart show => 0 204800 md0 BSD (100M) 0 16 - free - (8.0K) 16 204784 1 !0 (100M) => 0 204800 md1 BSD (100M) 0 16 - free - (8.0K) 16 204784 1 !0 (100M)
Diff Detail
Event TimelineComment Actions While this is good, and should be committed I think. Long term, though, I think we want to migrate this to makefs / mkimg with any enhancements to mkimg we might need (years ago, there were some blockers in this area, so I didn't even get started) Comment Actions Is this perhaps a bug that's been introduced into bsdlabel? I might expect fstype freebsd-ufs? Comment Actions Wow! I didn't notice !0 before. That's clearly wrong.
Comment Actions Note that I think D47652 is OK -- we should allow !0 for gpart, even if it's not what we want for nanobsd in this case. As @jlduran points out the gpart add -t !0 produces output that matches what happens today with bsdlabel, so there's a bug somewhere. We can either figure out why that's happening, or just switch to freebsd-ufs and mention in the commit that we also fixed a bug with the fs type. Comment Actions Yes, we arrived at the same conclusion on Discord (storage), as my experience with bsdlabe is exactly the same size as the type we were trying to add here. Thank you, I'll fix it. Comment Actions Hrm, from bsdlabel(8):
and indeed, #define FS_BSDFFS 7 /* 4.2BSD fast filesystem */ and if (type == FS_BSDFFS) return (g_part_alias_name(G_PART_ALIAS_FREEBSD_UFS)); So maybe bsdlabel has not changed, nanobsd has always done this, and nothing really cares that the fstype is 0. Regardless of the history this change is appropriate. Comment Actions In https://github.com/cschuber/freebsd-bsdlabel/blob/main/bsdlabel/bsdlabel.c, I tried adding: dp->p_fstype = FS_BSDFFS; to fixlabel() in order to get the desired results. There are no tests, I have no experience with it, it's outside of the tree now, so definitely won't fix it. Expect the commit within a few days. |