[patch] allow crash dumps to Linux swap partitions

Don Lewis truckman at FreeBSD.org
Tue Jan 10 00:17:26 UTC 2012


On  9 Jan, Doug Barton wrote:
> On 01/09/2012 01:11, Don Lewis wrote:
>> On  9 Jan, Adrian Chadd wrote:
>>> .. doesn't linux swap have some metadata somewhere?
>> 
>> Darned if I know, but it doesn't seem to care about FreeBSD swap data
>> overwriting its swap partition.
> 
> Have you had to do anything special for linux boot? I multi-boot myself
> and would love to be able to save space on my laptop by only having one
> universal swap partition. I started to look at doing this but found
> various docs that said don't unless you are able to recreate the
> metadata that Adrian referenced above.

Looks like this is safe to do.  There is some code in swaponsomething()
to avoid the first two page-size blocks of the swap file to avoid
overwriting the BSD label if the swap partition starts at sector zero of
a BSD partition.

Here's the confirmation that my Linux swap metadata is unmolested:
# dd if=/dev/da0s4 bs=4k count=1 | strings
1+0 records in
1+0 records out
4096 bytes transferred in 0.012188 secs (336063 bytes/sec)
jvLI
SWAP-sda4
SWAPSPACE2


I think UFS always avoided this problem, but I seem to remember SunOS
fixing this problem for swap.  Before Sun fixed this, SunOS would stop
on the first sector of the swap partition.  If you decided to use a
dedicated swap disk and started the swap partition at sector zero, the
label would get blown away as soon as you started using swap space.




More information about the freebsd-arch mailing list