Bug 276645 - Fix for swapon overwriting Linux swap header
Summary: Fix for swapon overwriting Linux swap header
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-26 17:34 UTC by Ricardo Branco
Modified: 2024-02-09 20:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.