Subject: Re: experiences, disk partitioning?
To: None <Chris_G_Demetriou@lagavulin.pdl.cs.cmu.edu>
From: Leo Weppelman <leo@ahwau.ahold.nl>
List: tech-kern
Date: 06/16/1995 08:42:00
> > > The problem is that we grab the first 8 partitions from the disk and
> > > then assign them based on the info that we find on the filesystem type
> > > stored in the parition info.  If the partition you want is right after
> > > 'b' on the disk, then please let me know what filesystem type you used
> > > to set it up and with which formatting program.  You can send it just to
> > > me, no need to send that to the whole list.  ;-)
> >
> > [ ... ]
> >
> > The partion table tells one how many partions (total) there are.
> > -  Why not use this number to search for possible partions?
> > -  Why are HFS files even included in the sd[0-7][a-h] list?
> > -  If you want to mount these file systems, why not have them show up
> >       as hfs[0-7][a-h]?
> 
> Err, uh, better yet, why not use the MacOS partition table as a
> possible 'seed' disklabel, then write a 'real' BSD disklabel to the
> 'root' BSD partition, and use what _IT_ says for partition name <->
> location mapping...
I guess it make sense to jump in here as I had much of the same discussion
for the Atari-port. We came up with basically this idea, using the 'native'
partition table as a 'seed' disklable. Storing the disklabel in the 'root'
partition is not always possible as not all disks may have it.

We ended up with the following implementation sceme:
 - No NetBSD label is present, 'native' partitioning is present:
   We build a fictious NetBSD disklabel. When it is written, it will be
   written to the first Ufs-filesystem. If there is no ufs-filesystem,
   writing is not allowed. We have no place to store it!
 - NetBSD label is present, 'native' partitioning is present:
   We use the NetBSD label. The 'native' partitioning is stored in the
	cpu_disklabel to allow warning users when a strange disklabel is
   created and to initially find the NetBSD disklabel.
 - No NetBSD label is present, no 'native' partitioning is present:
   We treat the disk as if the 'native' partitioning was just 1 partition
   containing the whole disk.
 - NetBSD label is present, no 'native' partitioning is present:
   Build a fake cpu_disklable containing the whole disk. Use the NetBSD
   disklabel.
> 
> that way:
> 	(1) people can have whichever partitions they want point to
> 		whatever areas of the disk they want them to point to.
> 		(with the exception of 'c'...  8-)
> 	(2) it (eventually, when the need for backward compatibility
> 		expires) removes a whole bunch of convoluted code from
> 		the kernel, and moves it into a user-land program
> 		(e.g. a 'macdiskpart'), the thing that generates the
> 		'seed' disklabel...  (in the mean time, that code
> 		would still be in the kernel, but run only as 'compat'
> 		code, and therefore hopefully less frequently...
I doubt the fact that this can ever be removed. It will be nice to
do some checking on the NetBSD disklabel when it's written. This allows
you to change your mind when you accidently include say the tail of a
'native' filesystem in your ufs-filesystem... You also need it as a
basic partition sceme when the disk contains more than just NetBSD,
otherwise you don't know where to look for the NetBSD label.

> 
> Actually, i think Allen said at one point that he was going to
> implement this, eventually...  8-)
I just got the code for the Atari-port from Waldi Ravens, who has written
it. I'm gonna find out this weekend if this sceme works out as expected.

BTW: I crossposted this to tech-kern because it might be of interest
to some other ports too.

Leo.