Subject: Where is the disklabel stored?
To: None <port-i386@netbsd.org>
From: Johan Ihren <johani@pdc.kth.se>
List: port-i386
Date: 02/10/2000 23:54:18
Hi,

I have a disk with no NetBSD filsystems on it (only Win98 and Lunix)
but I still need to (or at least want to) be able to mount them under
NetBSD. To do that I need a disklabel, and one is generated,
presumably from the DOS/fdisk partition info, on the fly when I
reference the disk and it basically works (i.e. I can mount the
partitions).

However, this is always ackompanied by warnings about "wd0: No disklabel".

So, I'd like to write a "real" disklabel down onto the disk to make
everything right. Reading disklabel(5) i find that the disklabel is
usually stored in the first track at offset LABELOFFSET (which is
usually equal to 1). 

I.e. the disklabel resides just after the bootselector (LILO in this
case) in block 0.

Now my questions are:

1. Is this correct? I.e. that the disklabel doesn't lie in the
   beginning of the NetBSD-part of the disk but rather in track 0.

2. Will the bootselector and disklabel be able to coexist or may the
   bootselector extend into the next block if needed (and hence
   overwrite the disklabel)?

3. Does anyone ever do this, i.e. write a NetBSD disklabel onto a
   non-NetBSD disk, or is it a BAD IDEA? I.e. "ought to work" is not
   as good as "I do this regularly"...

4. Track 1 and on (i.e. sector 63 and onwards) is WindozeLand. Is
   there any forseeable risk of disklabel(8) going astray and messing
   that up even a little?

   Fixing Unix filesystems after playing around too much with the MBR
   is usually not too worrisome, but I have a very healty respect for
   the brokenness of a Windows file system that has been poked in the
   side. In my experience that typically end up in the traditional
   Windoze Cleaning Ritual called a "Reinstall" ;-(

   Fixing the disklabel warning is NOT worth a WCR to me...


Regards,

Johan Ihrén, <johani@pdc.kth.se>,
phone: +46 (8) 790 6844, Center for Parallel Computers, 
Royal Institute of Technology, SE-100 44 Stockholm, Sweden