From owner-freebsd-questions@FreeBSD.ORG Fri Nov 16 14:51:36 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B88E055B for ; Fri, 16 Nov 2012 14:51:36 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from blue.qeng-ho.org (blue.qeng-ho.org [217.155.128.241]) by mx1.freebsd.org (Postfix) with ESMTP id 256B78FC08 for ; Fri, 16 Nov 2012 14:51:35 +0000 (UTC) Received: from fileserver.home.qeng-ho.org (localhost [127.0.0.1]) by fileserver.home.qeng-ho.org (8.14.5/8.14.5) with ESMTP id qAGEoAUs045743; Fri, 16 Nov 2012 14:50:10 GMT (envelope-from freebsd@qeng-ho.org) Message-ID: <50A652A1.6050402@qeng-ho.org> Date: Fri, 16 Nov 2012 14:50:09 +0000 From: Arthur Chance User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:16.0) Gecko/20121029 Thunderbird/16.0.2 MIME-Version: 1.0 To: dweimer@dweimer.net Subject: Re: Advanced Format Drive ? References: <26514.1353022306@tristatelogic.com> <46dc11a33f41ccb597efc1f2efb94403@dweimer.net> In-Reply-To: <46dc11a33f41ccb597efc1f2efb94403@dweimer.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Nov 2012 14:51:36 -0000 On 11/16/12 14:07, dweimer wrote: > On 2012-11-15 17:31, Ronald F. Guilmette wrote: >> (This stuff would probably be a lot less confiusing if I actually knew >> what I was doing, but...) >> >> OK, Warren, I've just done the following steps. The first two I drew >> from the manpage examples, and then followed those up with two commands >> from your tutorial. >> >> /sbin/gpart create -s GPT ada0 # manpage example is wrong, ad0 -> >> ada0 >> /sbin/gpart bootcode -b /boot/mbr ad0 # manpage wrong again, pmbr >> -> mbr >> gpart add -t freebsd-boot -l gpboot -b 40 -s 512K ada0 >> gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0 >> >> That last one, done at the suggestion of your tutorial page, has me >> completely perplexed, because of what is said, very explicitly, in the >> gpart(8) manpage: >> >> bootcode Embed bootstrap code into the partitioning scheme's >> metadata on >> the geom (using -b bootcode) or write bootstrap code >> into a >> partition (using -p partcode and -i index). >> >> Please note the use of the word "or". >> >> The man page is telling me to _either_ use the -p option _or else_ use >> the -p and -i options together. But you are telling me to use all three >> in one go! >> >> Forgive me, but I'm confused. (As you can tell by now, I am often easily >> confused. Sorry.) >> _______________________________________________ >> freebsd-questions@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >> To unsubscribe, send any mail to >> "freebsd-questions-unsubscribe@freebsd.org" > > I saw this, and well started wondering myself, as I have been using this > while doing work on booting FreeBSD via ZFS (of course using -p > /boot/gptzfsboot), I got the line from a tutorial on booting from ZFS. > Never thought much of it, until now, but I believe I see now why, the > secret is the pmbr, notice the "p". Its the protective mbr, it lets > formatting tools that understand mbr, but not gpart know that there is > something there, the actual boot code is in the partition. pmbr serves two purposes. It's both the first stage boot code, as a traditional BIOS always loads the first block of the disk into memory and runs it to boot the machine regardless of whether you've got an MBR or GPT disk, and it contains a traditional MBR that shows the entire disk is occupied by the first DOS partition (slice in BSD terminology) and that is of type 0xee. The latter means that GPT ignorant utilities see the disk as fully occupied by a partition of unknown type, which should mean they won't touch anything. The pmbr boot code understands the GPT table and runs through the partition entries looking for one of type freebsd-boot. When it finds one, it then loads the contents of the partition (or the first 545k if it's larger) into memory and jumps to the second stage boot loader.