Subject: Re: Some help with disklabel please?
To: Bill Studenmund <>
From: Jason Thorpe <>
List: current-users
Date: 08/09/1995 20:21:23
On Wed, 9 Aug 1995 19:59:15 -0700 (PDT) (Bill Studenmund) wrote:

 > > Also, your reasoning goes that all ports should also be able to read 
 > > SunOS disks (which was my original motivation; I had to plug one into my 
 > > hp380) since they're so prevalent.
 > Why not (given the above endian-isms)?

Like I said, it's a worthy goal ...

 > I misspoke. I meant disklabel (the kernel structure).

Yah ... a disklabel is required, although, if one isn't present on the 
disk, the kernel will make a fake one...

 > Why? This seems wasteful to me. Hmmm. Does it change that often?

Well, considering that a partition doesn't get _opened_ all that often, 
not it's not really wasteful at all.  But, this behavior _is_ useful.  
Take for example something I did on my hp380 just a week ago.  I had two 
partitons right next to each other, `f' and `g'.  I wanted to combine the 
space.  So, I backed up the data on each, unmounted both, eliminated 
partition `g' (and gave it's space to `f'), re-labeled, newfs'd, and 
remounted the new partition, all without rebooting.  It's a feature :-)

Basically, it's good consistency check, worth the low expense...

 > If the partition were read only once, the idea is that there are two
 > different lifetimes for the disklabel in the kernel, before the partition
 > is read, and after. The area of the disk that is 'c' before doesn't
 > have to have anything to do with the area that is 'c' after. This idea
 > fails if the partition is re-read frequently.

Huh?  What exactly do you mean by "different lifetimes for the disklabel 
in the kernel, before the partition is read, and after."?  That doesn't 
really make any sense to me...

To reiterate: the disklabel is read when any partition of a given 
disk is opened.

 > Actually, does it matter what convention is used? This ability is
 > mainly intended for occasional/special use. So what if the MSDOS-based
 > disk stuffs the full drive in `d' when your system normally puts it in
 > `c'. Chances are you wanted to just transfer data; these minor
 > differences can be lived with, no?

It has absolutely _nothing_ to do with being an MSDOS-based disk.  I 
don't have _any_ DOS/Windows/OS2 stuff on _any_ of my NetBSD/i386 boxes.  
However, all of them use `d' as `whole disk'.  Look at 
<machine/disklabel.h> for all the ports ... you'll see that most use the 
value `2' for RAW_PART, which is `c'.  But, the i386 uses `3' for 
RAW_PART.  It's not about the disk...

 > > Another point to make here, I suppose, is that not all ports that use 
 > > NetBSD-format disklabels keep them in the same place (for various 
 > > reasons).  Just something else to think about :-)
 > Can they be told apart?

Huh?  I assume you mean ``Is it easy to tell the difference between them?''
Umm .. the _is_ no difference between them, except for the size of the 
partition map in them.  For example, the MAXPARTITIONS value on the hp300 
is 8, but on the Amiga it's 16.  This means that sizeof(struct disklabel) 
is different on these platforms.  So, the disklabel checksums will be 
wrong if an hp300 reads an amiga's disklabel, since it won't read the 
whole disklabel ... The biggest problem is _finding_ the disklabels...

Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939