Bug 276645

Summary: Fix for swapon overwriting Linux swap header
Product: Base System Reporter: Ricardo Branco <rbranco>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Not A Bug    
Severity: Affects Only Me CC: jhb
Priority: ---    
Version: 14.0-STABLE   
Hardware: Any   
OS: Any   

Description Ricardo Branco 2024-01-26 17:34:15 UTC
The Linux swap partition uses a 4096-byte header that holds the label & UUID. You can see the structure here:
https://github.com/util-linux/util-linux/blob/master/include/swapheader.h

The problem is thus how to prevent FreeBSD from overwriting the header. It turns out there's a neat way to do just that with GEOM using the gnop system tool.

This PR modifies swapon to automate this process, which also works with /etc/fstab. This will benefit dual-boot installations and also live-CD's.

Fix: https://github.com/freebsd/freebsd-src/pull/1084
Comment 1 John Baldwin freebsd_committer freebsd_triage 2024-02-09 20:35:34 UTC
We can handle the discussion and code review over in the GitHub PR.