Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Apr 2009 13:29:33 +0800 (CST)
From:      Tai-hwa Liang <avatar@mmlab.cse.yzu.edu.tw>
To:        Marcel Moolenaar <xcllnt@mac.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Removal of GEOM_BSD, GEOM_MBR, GEOM_PC98 and GEOM_SUNLABEL
Message-ID:  <0904031327195.78401@www.mmlab.cse.yzu.edu.tw>
In-Reply-To: <A821815A-63BE-4354-A8A9-6C1C8D277422@mac.com>
References:  <DED07257-A1C7-4504-9A9E-CAAC2A9737D6@mac.com> <95891.1238477069@critter.freebsd.dk> <20090331133132.1e191836@ernst.jennejohn.org> <gqt3um$f77$3@ger.gmane.org> <20090331155542.74d89d64@ernst.jennejohn.org> <60084D1E-9F64-463A-A8E9-7A237D5C7661@mac.com> <0904011910169.29800@www.mmlab.cse.yzu.edu.tw> <DC771BC5-F356-4D81-9082-91C922CCBF38@mac.com> <0904020940371.36257@www.mmlab.cse.yzu.edu.tw> <4CCDEFD6-830E-4C8F-B7A2-B7878F8842BE@mac.com> <0904021314574.37737@www.mmlab.cse.yzu.edu.tw> <E6347C70-099B-494A-89E2-8CBDDAA36A85@mac.com> <09040309313414.76643@www.mmlab.cse.yzu.edu.tw> <A821815A-63BE-4354-A8A9-6C1C8D277422@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2 Apr 2009, Marcel Moolenaar wrote:
[...]
> 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)
> @@ -403,9 +403,13 @@
> 	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.

   Much better. I can see extended partition nodes after booting with the
patched kernel:

# ls -la /dev/ad*
crw-r-----  1 root  operator    0,  73  4  3 21:12 /dev/ad0
crw-r-----  1 root  operator    0,  79  4  3 21:12 /dev/ad0s1
crw-r-----  1 root  operator    0,  80  4  3 21:12 /dev/ad0s2
crw-r-----  1 root  operator    0,  82  4  3 21:12 /dev/ad0s2a
crw-r-----  1 root  operator    0,  83  4  3 21:12 /dev/ad0s2b
crw-r-----  1 root  operator    0,  84  4  3 21:12 /dev/ad0s2d
crw-r-----  1 root  operator    0,  85  4  3 21:12 /dev/ad0s2e
crw-r-----  1 root  operator    0,  81  4  3 21:12 /dev/ad0s3
crw-r-----  1 root  operator    0,  86  4  3 21:12 /dev/ad0s3+00000001
crw-r-----  1 root  operator    0,  88  4  3 21:12 /dev/ad0s3+000410a1
crw-r-----  1 root  operator    0,  90  4  3 21:12 /dev/ad0s3+00103bf1
crw-r-----  1 root  operator    0,  92  4  3 21:12 /dev/ad0s3+0017cda1
lrwxr-xr-x  1 root  wheel           14  4  3 21:12 /dev/ad0s5 -> ad0s3+00000001
lrwxr-xr-x  1 root  wheel           14  4  3 21:12 /dev/ad0s6 -> ad0s3+000410a1
lrwxr-xr-x  1 root  wheel           14  4  3 21:12 /dev/ad0s7 -> ad0s3+00103bf1
lrwxr-xr-x  1 root  wheel           14  4  3 21:12 /dev/ad0s8 -> ad0s3+0017cda1
# gpart show
=>       63  228338775  ad0  MBR  (109G)
          63   18688257    1  !12  (8.9G)
    18688320   16783200    2  freebsd  [active]  (8.0G)
    35471520  192855600    3  !15  (92G)
   228327120      11718       - free -  (5.7M)

=>       0  16783200  ad0s2  BSD  (8.0G)
          0    786432      1  freebsd-ufs  (384M)
     786432   4194304      2  freebsd-swap  (2.0G)
    4980736    393216      4  freebsd-ufs  (192M)
    5373952  11409248      5  freebsd-ufs  (5.4G)

=>        0  192855600  ad0s3  EBR  (92G)
           0   16783200      1  !131  (8.0G)
    16783200   50243760  266401  !11  (24G)
    67026960   31251024  1063921  freebsd  (15G)
    98277984   94577616  1559969  freebsd  (45G)

   The only downside is that I'll have to update /etc/fstab to boot correctly
as /dev/ad0s7a is still missing.

-- 
Thanks,

Tai-hwa Liang



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0904031327195.78401>