From owner-freebsd-questions@FreeBSD.ORG Sun Jan 24 15:59:14 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7629E106568F; Sun, 24 Jan 2010 15:59:14 +0000 (UTC) (envelope-from dan.naumov@gmail.com) Received: from mail-yw0-f197.google.com (mail-yw0-f197.google.com [209.85.211.197]) by mx1.freebsd.org (Postfix) with ESMTP id 18ED18FC1B; Sun, 24 Jan 2010 15:59:13 +0000 (UTC) Received: by ywh35 with SMTP id 35so2143495ywh.7 for ; Sun, 24 Jan 2010 07:59:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=zlZM2cWzVhqN2QvRpv6mWtSDfBXJT9EJPE9cHME4iLI=; b=X/x1QYhj2WtTWehGsJC5GyuS7t3AbBcAhvCevk3xMJeYtnh7X3WZFOxT51P9Eh0Z8+ 5xCMvwoHbg08sgSBPy5RyN3IOmyELptbJDi681Z1a4kQ7GlJXpydFhDwE2WljBV2llTK Qa/ghqKMEHkcIa+wr06/X/Ll9Jx4M8b4UeZaM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=WQR+i7fEge+9Kd4k3DK7auxbn2CNTQJbngPjAQ/8HHGrFUjBEiWxbpuqf2lPMwXkyz G1c6Nw/E1Vd1vkiwioHbp/6tsdNlNm+YY1wxh6HjxPFIsIXNkikLVP1HjjmJYHXoDARc gofNW6BEntk5UmCCzvujNO5pR0+eVoO1DDwrQ= MIME-Version: 1.0 Received: by 10.101.10.24 with SMTP id n24mr6614152ani.78.1264348753300; Sun, 24 Jan 2010 07:59:13 -0800 (PST) In-Reply-To: <20100124092947.B72039@starfire.mn.org> References: <20100122041237.GA22312@gothschlampen.com> <20100124092947.B72039@starfire.mn.org> Date: Sun, 24 Jan 2010 17:59:13 +0200 Message-ID: From: Dan Naumov To: John Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD-STABLE Mailing List , "Thomas K." , freebsd-questions@freebsd.org Subject: Re: Loader, MBR and the boot process X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2010 15:59:14 -0000 On Sun, Jan 24, 2010 at 5:29 PM, John wrote: > On Fri, Jan 22, 2010 at 07:02:53AM +0200, Dan Naumov wrote: >> On Fri, Jan 22, 2010 at 6:49 AM, Dan Naumov wrote= : >> > On Fri, Jan 22, 2010 at 6:12 AM, Thomas K. wro= te: >> >> On Fri, Jan 22, 2010 at 05:57:23AM +0200, Dan Naumov wrote: >> >> >> >> Hi, >> >> >> >>> I recently found a nifty "FreeBSD ZFS root installation script" and >> >>> been reworking it a bit to suit my needs better, including changing = it >> >>> from GPT to MBR partitioning. However, I was stumped, even though I >> >>> had done everything right (or so I thought), the system would get >> >>> stuck at Loader and refuse to go anywhere. After trying over a dozen >> >> >> >> probably this line is the cause: >> >> >> >> dd if=3D/mnt2/boot/zfsboot of=3D/dev/"${TARGETDISK}"s1a skip=3D1 seek= =3D1024 >> >> >> >> Unless by "swap first" you meant the on-disk location, and not the >> >> partition letter. If swap is partition "a", you're writing the loader >> >> into swapspace. >> >> >> >> >> >> Regards, >> >> Thomas >> > >> > At first you made me feel silly, but then I decided to double-check, I >> > uncommented the swap line in the partitioning part again, ensured I >> > was writing the bootloader to "${TARGETDISK}"s1b and ran the script. >> > Same problem, hangs at loader. Again, if I comment out the swap, >> > giving the entire slice to ZFS and then write the bootloader to >> > "${TARGETDISK}"s1a, run the script, everything works. >> >> I have also just tested creating 2 slices, like this: >> >> gpart create -s mbr "${TARGETDISK}" >> gpart add -s 3G -t freebsd "${TARGETDISK}" >> gpart create -s BSD "${TARGETDISK}"s1 >> gpart add -t freebsd-swap "${TARGETDISK}"s1 >> >> gpart add -t freebsd "${TARGETDISK}" >> gpart create -s BSD "${TARGETDISK}"s2 >> gpart add -t freebsd-zfs "${TARGETDISK}"s2 >> >> gpart set -a active -i 2 "${TARGETDISK}" >> gpart bootcode -b /mnt2/boot/boot0 "${TARGETDISK}" >> >> >> and later: >> >> dd if=3D/mnt2/boot/zfsboot of=3D/dev/"${TARGETDISK}"s2 count=3D1 >> dd if=3D/mnt2/boot/zfsboot of=3D/dev/"${TARGETDISK}"s2a skip=3D1 seek=3D= 1024 >> >> >> Putting the swap into it's own slice and then putting FreeBSD into >> it's own slice worked fine. So why the hell can't they both coexist in >> 1 slice if the swap comes first? > > I know what the answer to this USED to be, but I don't know if it is > still true (obviously, I think so, I or wouldn't waste your time). > > The filesystem code is all carefully written to avoid the very > first few sector of the partition. =A0That's because the partition > table is there for the first filesystem of the slice (or disk). > That's a tiny amout of space wasted, because it's also skipped on > all the other filesystems even though there's not actually anything > there, but it was a small inefficency, even in the 70's. > > Swap does not behave that way. =A0SWAP will begin right at the slice > boundry, with 0 offset. =A0As long as it's not the first partition, no > harm, no foul. =A0If it IS the first partition, you just nuked your parti= tion > table. =A0As long as SWAP owns the slice, again, no harm, no foul, but > if there were filesystems BEHIND it, you just lost 'em. > > That's the way it always used to be, and I think it still is. =A0SWAP can > only be first if it is the ONLY thing using that slice (disk), otherwise, > you need a filesystem first to protect the partition table. > -- > > John Lind > john@starfire.MN.ORG This explanation does sound logical, but holy crap, if this is the case, you'd think there would be bells, whistles and huge red label warnings in EVERY FreeBSD installation / partitioning guide out there warning people to not put swap first (unless given a dedicated slice) under any circumstances. The warnings were nowhere to be seen and lots of pointy hair first greyed and were then lost during the process of me trying to figure out why my system would install but wouldn't boot. - Sincerely, Dan Naumov