Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 2012 16:17:18 -0800 (PST)
From:      Don Lewis <truckman@FreeBSD.org>
To:        dougb@FreeBSD.org
Cc:        arch@FreeBSD.org, adrian@FreeBSD.org, alfred@FreeBSD.org
Subject:   Re: [patch] allow crash dumps to Linux swap partitions
Message-ID:  <201201100017.q0A0HItk037943@gw.catspoiler.org>
In-Reply-To: <4F0AB07D.1060208@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

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.




home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201100017.q0A0HItk037943>