From owner-freebsd-fs@FreeBSD.ORG Thu Aug 9 09:06:26 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 27452106566C for ; Thu, 9 Aug 2012 09:06:26 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id BD0C48FC0A for ; Thu, 9 Aug 2012 09:06:25 +0000 (UTC) Received: from lstewart.caia.swin.edu.au (lstewart.caia.swin.edu.au [136.186.229.95]) by lauren.room52.net (Postfix) with ESMTPSA id 30C0E7E820; Thu, 9 Aug 2012 18:57:24 +1000 (EST) Message-ID: <50237B73.9040301@freebsd.org> Date: Thu, 09 Aug 2012 18:57:23 +1000 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120702 Thunderbird/13.0.1 MIME-Version: 1.0 To: "freebsd-fs@freebsd.org" Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Subject: gpart rewrites pmbr in a way which breaks Win 7 EFI bootloader X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2012 09:06:26 -0000 Hi all, I recently got a new HP Compaq Elite 8200 work desktop which has a hybrid UEFI and regular BIOS arrangement. I want to dual-boot Win 7 64bit Enterprise via EFI and FreeBSD 9-STABLE via BIOS+gptzfsboot (until such time as we gain EFI support of course) on the machine and ran into a problem. I finally got around to analysing the issue in detail and wrote it up here: http://people.freebsd.org/~lstewart/misc/gpart_debug/ The summary is that FreeBSD's gpart rewrites the protective MBR with 0x80 (active) in the single MBR partition table entry, which makes the MS EFI bootloader unhappy and it will stop booting Win 7. The gpart command I ran to trigger the behaviour was "gpart modify -i 5 -t freebsd-zfs ", where partition 5 was already created in Win 7 and manually set using Win 7's diskpart utility to type freebsd-zfs i.e. the gpart command should have been a NOP. Indeed, the GPT remains unchanged, but the pmbr gets changed, which is what breaks Win 7 booting. After identifying the cause of the problem and a workaround (please see the README.txt at the above URL for full details and pre/post gpart dumps of the MBR+GPT), I have the following questions: - Should gpart be writing 0x80 (active) in the protective MBR entry? - Why is Windows EFI bootloader so sensitive to 0x80 in pmbr? - Should gpart be silently rewriting the protective MBR entry at all when only asked to make changes to the GPT? Thanks in advance for any insights and help. Cheers, Lawrence