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=0x83, 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=0x83, 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=0x83, 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égoire _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel