NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: booting from gpt/raid?



Greg Troxel wrote:
> 
> mlh%goathill.org@localhost (MLH) writes:
> 
> > I'm looking at exactly how to set up a couple of 4G disks in a
> 
> I am not really sure, but some advice:
> 
> Generally, the way booting on raid works is that (with a little bit of
> fuzz because I amy be off on details)
> 
>   it is limited to RAID-1, where therefore each disk is a copy (if you
>   only read)
> 
>   the MBR or first-stage boot is in the normal place for the disk
> 
>   the 2nd-stage boot, blocks 2-15, are in the partition that is labeled
>   bootable
> 
>   the bootable partition is of type RAID, and on those, the first 64
>   sectors are the raid header (except for 0/mbr, 1/disklabel, and
>   2-15/bootxx, so really latter 48 of first 64).  Then, the fs that
>   exists within the RAID-1 starts.
> 
>   the 2nd-stage boot code is able to figure out that the boot parttion
>   is of type raid, not ffs, and then does addr += 64 and tries again.  I
>   am unclear on if it recognizes the raid header, fails to recognize ffs
>   and tries blindly, or looks at the type.
> 
> therefore, I would expect
> 
>    two disks, each gpt
>    gpt disk-level boot setup normally
>    with a gpt partition of type raid
>    in those, bootblocks at front
>    and included ffs, via raid-1 init
>    set up to boot the raid parittion as if it were ffs
>    hope for the best and debug
> 
> to be a reasonable strategy.

Thanks. I lost you regarding how to do the 2nd-stage boot.

I see that it is wrong, but just for practice... that is what I
have so far:
(Good thing about gpt partitioning is that it is easily scriptable).

I did note that if I didn't specify a size, when creating the raid
type partition, if I didn't specify a size, it tried to put it up
front, starting at 34, labelled Unused. I'm wondering if gpt wants
to put a 2nd-stage bootable raid partition there.

------------
# gpt create wd2
dk0 at wd2 (swap_0) deleted

# gpt add -b 1024 -l boot_0 -t ffs -s 1g wd2
/dev/rwd2: Partition 1 added: 49f48d5a-b10e-11dc-b99b-0019d1879648 1024 2097152

wd2: GPT GUID: bcbdfa4c-0b35-442c-9813-f3ef257300c0
dk0 at wd2: "boot_0", 2097152 blocks at 1024, type: ffs

# gpt add -s 5243112 -t swap -i 2 wd2
/dev/rwd2: Partition 2 added: 49f48d32-b10e-11dc-b99b-0019d1879648 2098176 5243112

dk2 at wd2: "7664738f-158b-45a8-a1bd-0e70d1488604", 5243112 blocks at 2098176, type: swap

# gpt label -i 1 -l swap_0 wd2
/dev/rwd2: Partition 1 label changed

dk2 at wd2 (7664738f-158b-45a8-a1bd-0e70d1488604) deleted
wd2: GPT GUID: bcbdfa4c-0b35-442c-9813-f3ef257300c0
wd2: error 22 adding entry 0 (f6e065e3-5743-4d9b-8fc8-64bbd6c5002d), type 49f48d5a-b10e-11dc-b9
dk2 at wd2: "swap_0", 5243112 blocks at 2098176, type: swap

# gpt biosboot -L boot_0 wd2
/dev/rwd2: Partition 1 marked as bootable

dk2 at wd2 (7664738f-158b-45a8-a1bd-0e70d1488604) deleted
dk0 at wd2 (boot_0) deleted
wd2: GPT GUID: bcbdfa4c-0b35-442c-9813-f3ef257300c0
dk0 at wd2: "boot_0", 2097152 blocks at 1024, type: ffs
dk2 at wd2: "7664738f-158b-45a8-a1bd-0e70d1488604", 5243112 blocks at 2098176, type: swap

#  newfs dk0
/dev/rdk0: 1024.0MB (2097152 sectors) block size 16384, fragment size 2048
        using 6 cylinder groups of 170.67MB, 10923 blks, 21504 inodes.
super-block backups (for fsck_ffs -b #) at:
32, 349568, 699104, 1048640, 1398176, 1747712,

# installboot /dev/rdk0 /usr/mdec/bootxx_ffsv2
# mount /dev/dk0 /mnt
# cp /usr/mdec/boot /mnt
-r--r--r--  1 root  wheel  75832 Jul  1 22:07 boot

# gpt add -i 3 -s 7806695847 -l raid_0 -t raid wd2
/dev/rwd2: Partition 3 added: 49f48daa-b10e-11dc-b99b-0019d1879648 34 990

# gpt show -l wd2
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34         990         Unused
        1024     2097152      1  GPT part - boot_0
     2098176     5243112      2  GPT part - swap_0
     7341288  7806695847      3  GPT part - raid_0
  7814037135          32         Sec GPT table
  7814037167           1         Sec GPT header

Same for wd3 (except for labels)

# gpt show -l wd3
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34         990         Unused
        1024     2097152      1  GPT part - boot_1
     2098176     5243112      2  GPT part - swap_1
     7341288  7806695847      3  GPT part - raid_1
  7814037135          32         Sec GPT table
  7814037167           1         Sec GPT header

Does the boot stuff look ok there?

That brings up the question of whether swap should be type swap or
type raid and make a raid swap partition.



Home | Main Index | Thread Index | Old Index