Subject: Re: bin/21027: fdisk is missing an option to avoid displaying extended partition data
To: None <gnats-bugs@gnats.netbsd.org>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 04/06/2003 15:48:11
On Sun, Apr 06, 2003 at 04:21:26PM +0200, Manuel Bouyer wrote:
> On Sat, Apr 05, 2003 at 10:20:40PM +0100, David Laight wrote:
> > > >Synopsis:       fdisk is missing an option to avoid displaying extended partition data
> > 
> > I have a version (which I must do some further testing of) that is
> > slightly less verbose - unless gives one, or more, -v paramters.
> > 
> > The current extended partition print assumes (incorrectly) that the
> > extended partition is a tree structure, not a list.
> > The default output from my version is:
> > 
> > 
> > Disk: /dev/rwd0d
> > NetBSD disklabel disk geometry:
> > cylinders: 16383, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
> > total sectors: 40032696
> > 
> > BIOS disk geometry:
> > cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
> > total sectors: 40032696
> > 
> > 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: current
> >     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)
> >     bootmenu: test 0
> >     start 12498633, size 12305727 (6009 MB, Cyls 778-1544)
> > E1: NetBSD (sysid 169)
> >     bootmenu: test1
> >     start 24804423, size 4096512 (2000 MB, Cyls 1544-1799)
> > E2: NetBSD (sysid 169)
> >     bootmenu: test2
> >     start 28900998, size 3614562 (1765 MB, Cyls 1799-2024)
> > Bootselector enabled, infinite timeout.
> 
> How do you deal with multiple extended partitions, and extended partitions in
> extended partitions ?
> I think a tree structure is closed to what and extended partition is, than
> a list.

Multiple extended partitions are illegal.  Although each extended
partition appears to allow for 4 partitions, it is only allowed to
contain a single normal partition and a further extended one.

In a validly formatted extended partition each partition starts on
a cylinder boundary and has the first track reserved to contain
(in its first sector) the details of that partition and the location
of the next one.  These are always linked in increasing sector number
order.

Clearly there is a massive scope for incorrectly formatted extended
partitions - but none of the standard fdisk utilities should let
you generate them.

	David

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