Bug 256535 - swapon nukes non FreeBSD swap file systems
Summary: swapon nukes non FreeBSD swap file systems
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-10 16:28 UTC by Bjoern A. Zeeb
Modified: 2021-06-19 15:08 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern A. Zeeb freebsd_committer 2021-06-10 16:28:35 UTC
Hi,

if one repurposes a FreeBSD swap file system for another file system (e.g. 2nd system) or mistyypes the partition in fstab
and FreeBSD boots with that swap in fstab, swapon -a will nuke that file system even if it is no longer a freebsd-swap in GPT
(no idea about MBR anymore).
It seems to be a good idea to put in a check, warn and let the user fix this rather than simply activating swap and with
that likely nuking a file system there..
It's probably a bit tricky to find all the cases but it should be fairly easy to test in a VM so..

#BeginnersTask
Comment 1 Marek Zarychta 2021-06-10 16:44:13 UTC
(In reply to Bjoern A. Zeeb from comment #0)
Probably it wasn't an issue when swap lied obligatory on "b" BSD swap partition under FreeBSD slice on MBR partitioned disk. 
The proposed check could be also relevant with regard to configuring the dump device.