Subject: Re: overlap, was Re: Work-in-progress "wedges" implementation
To: Jason Thorpe <thorpej@shagadelic.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 09/25/2004 08:19:12
> I forget ... do MBR Extended Partitions specify absolute offsets, or 
> offsets relative to the chunk that contains the nested MBR partition 
> map?

The MBR Extended partition is a linked list of partition descriptors in,
I believe, disk sector order, that describes how the large MBR partition
is split.

Each 'list entry' is formatted like the first track of a disk - so contains
what looks like, but is not identical to, the MBR table.  Only the first 2
entries in that MBR table are used, the first describes next slot with
numbers relative to the start of the Extended partition, the second is the
data partition in the current slot with numbers relative to the current slot
(ie start is 63).

(The MBR Extended partition isn't the leafy tree it first appears to be!)

...

On i386 (and similar MBR disks) the NetBSD disklabel is best thought of as
describing the whole disk.  It just happens to be saved on disk at the start
of EVERY netbsd partition.

For Instance I have this MBR:
    Partition table:
    0: NetBSD (sysid 169)
	bootmenu: net 1.5.
	start 4209030, size 8289540 (4048 MB, Cyls 262-778), Active
    1: Primary DOS with 32 bit FAT (sysid 11)
	bootmenu: win98
	start 63, size 4208967 (2055 MB, Cyls 0-262)
    2: NetBSD (sysid 169)
	bootmenu: 1.6
	start 32515560, size 7517136 (3670 MB, Cyls 2024-2491/234/40)
    3: Ext. partition - LBA (sysid 15)
	start 12498570, size 20016990 (9774 MB, Cyls 778-2024)
    Extended partition table:
    E0: NetBSD (sysid 169)
	start 12498633, size 12305727 (6009 MB, Cyls 778-1544)
    E1: NetBSD (sysid 169)
	start 24804423, size 4096512 (2000 MB, Cyls 1544-1799)
    E2: NetBSD (sysid 169)
	bootmenu: 2.0
	start 28900998, size 3614562 (1765 MB, Cyls 1799-2024)

matching this disklabel (sorted into sector order):
    #       size    offset  fstype fsize bsize cpg/sgs]
     c:  8289540   4209030  unused     0     0     # (Cyl.  4175*-  12399*)
     d: 40032696         0  unused     0     0     # (Cyl.     0 -  39714*)
     f:  4208967        63   MSDOS                 # (Cyl.     0*-   4175*)
     a:  1092042   4209030  4.2BSD  1024  8192  0  # (Cyl.  4175*-   5258)
     b:  2098656   5301072    swap                 # (Cyl.  5259 -   7340)
     e:  5098842   7399728  4.2BSD  1024  8192  0  # (Cyl.  7341 -  12399*)
     i: 12305727  12498633  4.2BSD  1024  8192  0  # (Cyl. 12399*-  24607*)
     j:  4096512  24804423  4.2BSD  1024  8192  0  # (Cyl. 24607*-  28671*)
     k:  3614562  28900998  4.2BSD  1024  8192  0  # (Cyl. 28671*-  32257*)
     h:  4194304  32515560  4.2BSD  1024  8192  0  # (Cyl. 32257*-  36418*)
     g:  3322832  36709864  4.2BSD  1024  8192  0  # (Cyl. 36418*-  39714*)

Three of the five NetBSD MBR partitions are bootable.

	David

-- 
David Laight: david@l8s.co.uk