Bug 252585 - dump partition in /etc/fstab being used as swap
Summary: dump partition in /etc/fstab being used as swap
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 12.2-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-01-11 18:01 UTC by g.s
Modified: 2021-01-12 20:05 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description g.s 2021-01-11 18:01:43 UTC
I added a partition for crash dumps, because savecore doesn't find the core after dumping to the mirror, so my fstab looks like this:

/dev/mirror/swap        none            swap    sw      0       0
/dev/ada0p4             none            dump    sw      0       0

After reboot, the dump device is being used as swap. I'm not sure if this is a bug, but I'm expecting only the mirror being used for swap.
Comment 1 Ed Maste freebsd_committer 2021-01-12 16:53:18 UTC
From rc.conf(5):

     dumpdev     (str) Indicates the device (usually a swap partition) to
                 which a crash dump should be written in the event of a system
                 crash.  If the value of this variable is "AUTO", the first
                 suitable swap device listed in /etc/fstab will be used as
                 dump device.  Otherwise, the value of this variable is passed
                 as the argument to dumpon(8).  To disable crash dumps, set
                 this variable to "NO".

Can you confirm that setting dumpdev=/dev/ada0p4 addresses the issue?

What we probably need to do is change the logic to:

If the value of this variable is "AUTO", the first dump device listed in /etc/fstab will be used, or the first suitable swap device if no dump device is found.
Comment 2 g.s 2021-01-12 18:11:32 UTC
Im not sure what you mean by "adresses this issue", I did have dumpdev="/dev/ada0p4" in my rc.conf when the dump partition was added as swap during boot.

IMO, however, something categorized as dump via fstab should never be added as swap.

If you want me to try different settings, I'd prefer to not reboot for a few weeks.

(The reason I ran into this was a crash that claimed to be writing a dump on the /dev/mirror/swap, savecore did not find one at boot, though. So I tried to be sure it works next time.)
Comment 3 Ed Maste freebsd_committer 2021-01-12 20:05:04 UTC
Oh, sorry I read your report the wrong way around - I thought you meant the swap device was still being used as dumpdev. I agree that a dump device should not be used for swap.

With fstab as in the original report and no explicit dumpdev setting I would currently expect /dev/mirror/swap to (attempt to) be used as the dump device, but this is something that should be fixed.