From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OyBj9-0001AS-Df for mharc-grub-devel@gnu.org; Tue, 21 Sep 2010 18:54:19 -0400 Received: from [140.186.70.92] (port=53357 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyBj6-00018S-An for grub-devel@gnu.org; Tue, 21 Sep 2010 18:54:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyBj3-0003rb-9a for grub-devel@gnu.org; Tue, 21 Sep 2010 18:54:16 -0400 Received: from iona.labri.fr ([147.210.8.143]:43224) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyBj3-0003r2-1o for grub-devel@gnu.org; Tue, 21 Sep 2010 18:54:13 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by iona.labri.fr (Postfix) with ESMTP id E7A0936BF8 for ; Wed, 22 Sep 2010 00:54:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at labri.fr Received: from iona.labri.fr ([127.0.0.1]) by localhost (iona.labri.fr [127.0.0.1]) (amavisd-new, port 10027) with LMTP id e5e21wIUMrHR for ; Wed, 22 Sep 2010 00:54:10 +0200 (CEST) Received: from [192.168.1.50] (c2433-1-88-160-112-182.fbx.proxad.net [88.160.112.182]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by iona.labri.fr (Postfix) with ESMTP id B01A836BF0 for ; Wed, 22 Sep 2010 00:54:10 +0200 (CEST) Message-ID: <4C993792.1050908@labri.fr> Date: Wed, 22 Sep 2010 00:54:10 +0200 From: =?UTF-8?B?R3LDqWdvaXJlIFN1dHJl?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100805 Iceowl/1.0b1 Icedove/3.0.6 MIME-Version: 1.0 To: The development of GNU GRUB References: <1285054276.10425.39.camel@hp.my.own.domain> <20100921145445.GQ8579@caffeine.csclub.uwaterloo.ca> <1285098134.10425.88.camel@hp.my.own.domain> In-Reply-To: <1285098134.10425.88.camel@hp.my.own.domain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: Improperly nested partitions, help needed! X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2010 22:54:17 -0000 On 09/21/2010 09:42 PM, Svante Signell wrote: > # file /tmp/sda3.mbr /tmp/sda3.mbr: x86 boot sector; GRand Unified > Bootloader, stage1 version 0x3, 1st sector stage2 0xdd29b38; > partition 1: ID=3D0x83, starthead 239, startsector 63, 35153937 > sectors, extended partition table (last)\011, code offset 0x48 I'm surprised that file is able to tell that this is an extended partition table. If we could reliably distinguish MBR partition tables from EBR ones, then we could prevent GRUB from considering such EBR partition tables. But I don't see how a such a distinction could be made: as far as I know, any EBR partition table could appear in an MBR. So out of curiosity, I looked a bit deeper at the behavior of the file command, and I'm afraid that the result of file is not 100% reliable in this respect: for a partition table with only one used entry, file detects it as an EBR partition table if the entry is not active, as shown by this example (one sector in /tmp/sect.bin): Device Boot Start End #sectors Id System /tmp/sect.bin1 * 63 41945714 41945652 83 Linux /tmp/sect.bin2 0 - 0 0 Empty /tmp/sect.bin3 0 - 0 0 Empty /tmp/sect.bin4 0 - 0 0 Empty $ od -Ax -t x1 /tmp/sect.bin 000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 01 0001c0 01 00 83 fe ff ff 3f 00 00 00 34 0a 80 02 00 00 0001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa 000200 $ file /tmp/sect.bin /tmp/sect.bin: x86 boot sector; partition 1: ID=3D0x83, active, starthead 1, startsector 63, 41945652 sectors, code offset 0x0 Everything looks good. But after making the partition inactive, we get: $ od -Ax -t x1 /tmp/sect.bin 000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 0001c0 01 00 83 fe ff ff 3f 00 00 00 34 0a 80 02 00 00 0001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa 000200 $ file /tmp/sect.bin /tmp/sect.bin: x86 boot sector; partition 1: ID=3D0x83, starthead 1, startsector 63, 41945652 sectors, extended partition table (last)\011, code offset 0x0 Still, this partition table may well be contained in an MBR. Gr=C3=A9goire