Subject: Re: Some help with disklabel please?
To: Bill Studenmund <firstname.lastname@example.org>
From: Jason Thorpe <email@example.com>
Date: 08/10/1995 10:22:04
On Thu, 10 Aug 1995 09:58:31 -0700 (PDT)
firstname.lastname@example.org (Bill Studenmund) wrote:
[ I trimmed the long Cc: list. --thorpej ]
> My first thought was to build a fake disklabel, use it to read whatever
> needs to be read to get a real disklabel, throw out the fake disklabel as
> it's not needed anymore, and make the real one.
This already happens ... Say, for example, I install a band-new disk on
my hp380 ... pretend it's sd4 ... the process I usually go though is:
# cd /etc/disklabels
# disklabel sd4 > sd4.label (grabs fake in-core copy)
# vi sd4.label
[ . . . edit label . . . ]
# disklabel -r -R sd4 sd4.label
# newfs /dev/rsd4[whatever]
Note that when you update the on-disk copy, the in-core copy is updated
> Ah, but did you (or the kernel secretly behind your back) use dos
> partitioning software/conventions? You (or someone else) described how
> the i386 port has `c' as the NetBSD part of the disk, and `d' the whole
> disk. To me, this means that your disk _can_ have DOS stuff in it. As I
> understand it, if you take your all-NetBSD disks to a DOS machine,
> the DOS machine will know that the drive is formated, and that it is
> full of non-DOS partitions. Granted it will have no clue as to what to
> do with the non-DOS stuff, but DOS will know not to step on the data.
Well, of course ... I'm not really sure I see your point, though. (I
mean, that's the whole point of `d' is the whole disk, and `c' is
> Oops! Take a step back. Is there a difference ON DISK? Looking at just
> the disk, can't we tell the difference between formats between various
Ummm ... sort of ... You can just read what you think is the right place
and look for the right magic numbers, providing the on-disk format that
you're reading provides such a mechanism for validating the label. If
not, then you're just second-guessing.
> If all these patterns are different, then we can look for each one in
> turn. If we find one, we know the partitioning scheme in use on the
> disk. We then look to the port for that machine and ask it to read the
> disklabel, as it already understands this partitioning scheme.
That's what my code did ... it gave preference to the port's `native'
disklabel format, and then jumped though function pointers looking though
the other formats until it didn't fail anymore. If none of them
succeeded, `no disk label' was reported and a fake label generated.
> Though you do bring up one interesting question. What in the system REALLY
> cares where the whole disk gets shoved? Isn't it just convention?
Lots of things use RAW_PART ... see the MI SCSI code for examples ...
Jason R. Thorpe email@example.com
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