Subject: RE: RAIDframe and bootblocks
To: Brad Volz <bradv@affectation.org>
From: Conrad T. Pino <NetBSD-Current@Pino.com>
List: netbsd-help
Date: 02/10/2004 19:43:34
> From: netbsd-help-owner@NetBSD.org On Behalf Of Brad Volz
> 
> "cannot find operating system" or similar.

Sounds like this could be missing or corrupt Master Boot Record (MBR).

> The root filsystem is at the beginning of the RAID, at least that is what
> I intended.  Displaying the disklabel of the RAID device would be a way to
> verify this, correct?  If so, I'll capture that output.

Yes but don't forget fdisk (i386 or similar ports assumed):

# fdisk sd1
Disk: /dev/rsd1d
NetBSD disklabel disk geometry:
cylinders: 14627, heads: 3, sectors/track: 405 (1215 sectors/cylinder)
total sectors: 17774160

BIOS disk geometry:
cylinders: 1024, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 17774160

Partition table:
0: <UNUSED>
1: <UNUSED>
2: <UNUSED>
3: NetBSD (sysid 169)
    start 63, size 17767827 (8676 MB, Cyls 0-1106), Active
#
# disklabel sd1
# /dev/rsd1d:
type: SCSI
disk: ibm09g0s00
label: 
flags:
bytes/sector: 512
sectors/track: 405
tracks/cylinder: 3
sectors/cylinder: 1215
cylinders: 14627
total sectors: 17774160
rpm: 7200
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

5 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:    580545        63     4.2BSD   1024  8192 41472  # (Cyl.      0*-    477*)
 b:   1064448    580608       swap                     # (Cyl.    477*-   1353*)
 c:  17767827        63     unused      0     0        # (Cyl.      0*-  14623*)
 d:  17774160         0     unused      0     0        # (Cyl.      0 -  14628*)
 e:  16129104   1645056     4.2BSD   1024  8192 46616  # (Cyl.   1353*-  14628*)

> When you say that the raid volume needs to start at the beginning of the
> mbr partition, would that be at ~ block 0?  I seem to recall using a value
> of 63 there ( a similar intial offset to what was there from a sysinst
> install without RAID ), so perhaps that is part of my problem as well.

Assuming i386, not block 0, 63 sounds better.  I assume "fdisk" and "disklabel"
line up like non-RAID disks do.

Notice excerpts of fdisk & disklabel below:

    fdisk: 3: NetBSD (sysid 169)
    fdisk:     start 63, size 17767827 (8676 MB, Cyls 0-1106), Active

disklabel: #        size    offset     fstype [fsize bsize cpg/sgs]
disklabel:  c:  17767827        63     unused      0     0        # (Cyl.      0*-  14623*)

Notice: "fdisk start"      (63) == "disklabel offset"     (63)
Notice: "fdisk size" (17767827) == "disklabel size" (17767827)

Microsoft MBR has boot code and 4 slot "partition" table.
Unix "label" has boot code & 5 (a-e) to 11 (a-p) "slices".

MBR & label have same function, different format & locations.
Microsoft partition has same function as Unix slice except
partitions never overlap and special slices do (c-d).
Slice c spans MBR partition, slice d spans physical disk.
Slices a-b & e-p usually don't overlap.  Some ports don't
have an MBR and then slices c-d both span physical disk.
================================================================
MBR boot code selects "active" MBR partition and loads more
boot code from active partition i.e. slice .  Slice boot code
prompts for boot options and loads kernel.

MBR is at offset 0, don't know where label is.

Fixing boot code in MBR, read about "fdisk" options "-i -c":
http://netbsd.gw.com/cgi-bin/man-cgi?fdisk++NetBSD-current

Fixing boot code in label & file system, check out "installboot":
http://netbsd.gw.com/cgi-bin/man-cgi?installboot+8+NetBSD-current

> thanks,

ur welcome.

> Brad

Conrad