Subject: Re: Skipping Ontrack Disk Manager drivers
To: Gilbert Fernandes <gilbert.fernandes@spamcop.net>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 12/25/2005 23:49:59
------=_Part_668_16935087.1135550999120
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
On 12/25/05, Gilbert Fernandes <gilbert.fernandes@spamcop.net> wrote:
> > A couple weeks ago I was lend a hard disk that had the Ontrack
> > Disk Manager drivers on it. These create a fake partition table on
> > the first sector of the disk and the real partition table is shifted to
> > sector 63 (I don't know if this number depends on something or if
> > it is always the same), so I couldn't read what I needed.
>
> First track is reserved. That means the first 63 sectors if each sector i=
s
> 512-bytes long.
>
> Last track is usually reserved too for historical reasons (the disk head =
was
> kept there when not used and the disk spinning so it would crash there if
> the disk had a vertical hit).
>
> The whole first track is reserved.
Aha, that's what I thought because 63 sounded extremely familiar.
However, several pages I found (mostly mails) mentioned 63 explicitly,
which confused me.
The attached patch should now DTRT.
--
Julio M. Merino Vidal <jmmv84@gmail.com>
The Julipedia - http://julipedia.blogspot.com/
The NetBSD Project - http://www.NetBSD.org/
------=_Part_668_16935087.1135550999120
Content-Type: text/x-patch; name=patch.diff; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="patch.diff"
? .subr_disk_mbr.c.swp
Index: subr_disk_mbr.c
===================================================================
RCS file: /cvsroot/src/sys/kern/subr_disk_mbr.c,v
retrieving revision 1.13
diff -u -r1.13 subr_disk_mbr.c
--- subr_disk_mbr.c 18 Dec 2005 17:02:45 -0000 1.13
+++ subr_disk_mbr.c 25 Dec 2005 22:47:07 -0000
@@ -140,6 +140,24 @@
/* Copy data out of buffer so action can use bp */
memcpy(ptns, &mbr->mbr_parts, sizeof ptns);
+ /* Look for drivers and skip them */
+ if (ptns[0].mbrp_type == MBR_PTYPE_DM6_DDO) {
+ /* We've found DM6 DDO drivers. Ensure that there
+ * are no other partitions in the MBR and jump to
+ * the real MBR. */
+ boolean_t ok = TRUE;
+
+ for (i = 1; i < MBR_PART_COUNT; i++)
+ if (ptns[i].mbrp_type != MBR_PTYPE_UNUSED)
+ ok = FALSE;
+
+ if (ok) {
+ this_ext = le32toh(a->lp->d_secpercyl /
+ a->lp->d_ntracks);
+ continue;
+ }
+ }
+
/* look for NetBSD partition */
next_ext = 0;
dp = ptns;
------=_Part_668_16935087.1135550999120--