From owner-freebsd-arch@FreeBSD.ORG Tue Jan 10 00:17:26 2012 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59A34106564A; Tue, 10 Jan 2012 00:17:26 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (gw.catspoiler.org [75.1.14.242]) by mx1.freebsd.org (Postfix) with ESMTP id 278D18FC14; Tue, 10 Jan 2012 00:17:26 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id q0A0HItk037943; Mon, 9 Jan 2012 16:17:20 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <201201100017.q0A0HItk037943@gw.catspoiler.org> Date: Mon, 9 Jan 2012 16:17:18 -0800 (PST) From: Don Lewis To: dougb@FreeBSD.org In-Reply-To: <4F0AB07D.1060208@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: arch@FreeBSD.org, adrian@FreeBSD.org, alfred@FreeBSD.org Subject: Re: [patch] allow crash dumps to Linux swap partitions X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 00:17:26 -0000 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.