Re: Removal of GEOM_BSD, GEOM_MBR, GEOM_PC98 and GEOM_SUNLABEL

From: Tai-hwa Liang <avatar_at_mmlab.cse.yzu.edu.tw>
Date: Mon, 31 May 2010 18:57:54 +0800 (CST)
On Thu, 2 Apr 2009, Marcel Moolenaar wrote:
> On Apr 2, 2009, at 6:35 PM, Tai-hwa Liang wrote:
>
>> On Thu, 2 Apr 2009, Marcel Moolenaar wrote:
>>> Can you dump the first 2 sectors of slice 3 and
>>> send it to me:
>>> 	dd if=/dev/ad0s3 of=/tmp/dump.dd count=2 bs=512
>
> *snip*
>> 000001b0  00 00 00 00 00 f2 0e 00  00 00 00 00 00 00 00 01 
>> |................|
>> 000001c0  c1 ff 83 ef ff ff 3f 00  00 00 21 17 00 01 00 00 
>> |......?...!.....|
>> 000001d0  c1 ff 05 ef ff ff 60 17  00 01 b0 a8 fe 02 00 00 
>> |......`.........|
>> 000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 
>> |................|
>> 000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa 
>> |..............U.|
> *snip*
>
> It looks like you have a boot menu entry at 0x1b6. Can you
> try the following patch:
>
> Index: g_part_ebr.c
> ===================================================================
> --- g_part_ebr.c	(revision 190655)
> +++ g_part_ebr.c	(working copy)
> _at__at_ -403,9 +403,13 _at__at_
> 	if (magic != DOSMAGIC)
> 		goto out;
>
> -	/* The sector is all zeroes, except for the partition entries. */
> +	/*
> +	 * The sector is all zeroes, except for the partition entries
> +	 * and a possible IBM Boot Manager menu entry. The menu entry
> +	 * is 9 bytes in length and preceeds the partition entries.
> +	 */
> 	sum = 0;
> -	for (index = 0; index < DOSPARTOFF; index++)
> +	for (index = 0; index < DOSPARTOFF - 9; index++)
> 		sum += buf[index];
> 	if (sum != 0)
> 		goto out;
>
>
> The real fix will be a bit more involved, because we should
> avoid wiping out the boot menu entry on a write. But at least
> with the patch you should be able to read the EBR.

Hi Marcel,

   Excuse me for bringing this old topic back.  Just found another 
configuration which will cause the checksumming in current g_part_ebr.c
returns !0 value:

# gpart show
=>       63  625142385  ad4  MBR  (298G)
          63          1       - free -  (512B)
          64  182466206    1  !7  (87G)
   182466270   20980890    2  freebsd  [active]  (10G)
   203447160  398395935    3  !15  (190G)
   601843095   23294250    4  !7  (11G)
   625137345       5103       - free -  (2.5M)

=>       0  20980890  ad4s2  BSD  (10G)
          0        16         - free -  (8.0K)
         16    786432      1  freebsd-ufs  (384M)
     786448   2097152      2  freebsd-swap  (1.0G)
    2883600    786432      4  freebsd-ufs  (384M)
    3670032  17310858      5  freebsd-ufs  (8.3G)

# dd if=/dev/ad4s3 count=2 bs=512 | hexdump -C

00000000  eb 48 90 00 00 00 00 00  00 00 00 00 00 00 00 00  |.H..............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 03 02  |................|
00000040  ff 01 00 80 5c 60 c3 10  00 08 fa 90 90 f6 c2 80  |....\`..........|
00000050  75 02 b2 80 ea 59 7c 00  00 31 c0 8e d8 8e d0 bc  |u....Y|..1......|
00000060  00 20 fb a0 40 7c 3c ff  74 02 88 c2 52 be 81 7d  |. .._at_|<.t...R..}|
00000070  e8 36 01 f6 c2 80 74 56  b4 41 bb aa 55 cd 13 5a  |.6....tV.A..U..Z|
00000080  52 72 4b 81 fb 55 aa 75  45 a0 41 7c 84 c0 78 3e  |RrK..U.uE.A|..x>|
00000090  75 05 83 e1 01 74 37 66  8b 4c 10 be 05 7c c6 44  |u....t7f.L...|.D|
000000a0  ff 01 66 8b 1e 44 7c c7  04 10 00 c7 44 02 01 00  |..f..D|.....D...|
000000b0  66 89 5c 08 c7 44 06 00  70 66 31 c0 89 44 04 66  |f.\..D..pf1..D.f|
000000c0  89 44 0c b4 42 cd 13 72  05 bb 00 70 eb 7d b4 08  |.D..B..r...p.}..|
000000d0  cd 13 73 0a f6 c2 80 0f  84 e8 00 e9 8d 00 be 05  |..s.............|
000000e0  7c c6 44 ff 00 66 31 c0  88 f0 40 66 89 44 04 31  ||.D..f1..._at_f.D.1|
000000f0  d2 88 ca c1 e2 02 88 e8  88 f4 40 89 44 08 31 c0  |.........._at_.D.1.|
00000100  88 d0 c0 e8 02 66 89 04  66 a1 44 7c 66 31 d2 66  |.....f..f.D|f1.f|
00000110  f7 34 88 54 0a 66 31 d2  66 f7 74 04 88 54 0b 89  |.4.T.f1.f.t..T..|
00000120  44 0c 3b 44 08 7d 3c 8a  54 0d c0 e2 06 8a 4c 0a  |D.;D.}<.T.....L.|
00000130  fe c1 08 d1 8a 6c 0c 5a  8a 74 0b bb 00 70 8e c3  |.....l.Z.t...p..|
00000140  31 db b8 01 02 cd 13 72  2a 8c c3 8e 06 48 7c 60  |1......r*....H|`|
00000150  1e b9 00 01 8e db 31 f6  31 ff fc f3 a5 1f 61 ff  |......1.1.....a.|
00000160  26 42 7c be 87 7d e8 40  00 eb 0e be 8c 7d e8 38  |&B|..}._at_.....}.8|
00000170  00 eb 06 be 96 7d e8 30  00 be 9b 7d e8 2a 00 eb  |.....}.0...}.*..|
00000180  fe 47 52 55 42 20 00 47  65 6f 6d 00 48 61 72 64  |.GRUB .Geom.Hard|
00000190  20 44 69 73 6b 00 52 65  61 64 00 20 45 72 72 6f  | Disk.Read. Erro|
000001a0  72 00 bb 01 00 b4 0e cd  10 ac 3c 00 75 f4 c3 00  |r.........<.u...|
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
000001c0  c1 ff 82 fe ff ff 3f 00  00 00 84 1c 20 00 00 fe  |......?..... ...|
000001d0  ff ff 05 fe ff ff c3 1c  20 00 81 53 2a 01 00 00  |........ ..S*...|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400

   Not sure which utility wrote code into 0x0 ~ 0x1bd; however, after 
removing the "if (sum != 0) goto out;" fragment from g_part_ebr_probe, 
/dev/ad4s[5-9] came back to work.  Without this hack, RELENG_8 and
afterwards(switching from GEOM_MBR to GEOM_PART_[ME]BR) won't give me an 
usable /home.

   http://en.wikipedia.org/wiki/Extended_boot_record says that there may
be another boot loader inside 0x0 ~ 0x1bd.  If that's the case, I'm
wondering if there is any disadvantage to disable the checksumming
against 0x60 ~ 0x1b5?

-- 
Thanks,

Tai-hwa Liang
Received on Mon May 31 2010 - 09:17:55 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:04 UTC