NetBSD-Users archive

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

Re: RAID and GPT



    Date:        Thu, 30 Apr 2015 01:26:27 +0000 (UTC)
    From:        mlelstv%serpens.de@localhost (Michael van Elst)
    Message-ID:  <mhs0c2$6i1$1%serpens.de@localhost>

  | RAID autoconf will tell the kernel to use partition 'a' of
  | the RAID device as root, [...]

Not quite when GPT is used on the raid.

What really happens is that the kernel seeks a wedge labelled "raidNa"
(where raidN is the autoconfigured as root raid array) and uses that as
the root.

Eg: on one of my systems I have (giving output from a modified
version of Mouse's "raidstat" script) ...

raid1: AutoConfigured L1 /dev/dk14 /dev/wd1e
raid2: AutoConfigured L5 /dev/wd3e /dev/dk15 /dev/wd1g
raid4: AutoConfigured L1 /dev/dk4 /dev/wd3l
raid7: AutoConf Root  L1 /dev/dk9 /dev/dk19

"raid7" is autoconfigured as the root device.  (The weird numbering is
because this system was built from an earlier system, raidM (for M < 6)
were all used there, raid6 was used temporarily during the transition,
which left raid7 as the next available...  raid 1 2 & 4 are all that
remain from the old config, though they're used only to keep old files
that in practice are never touched...  raid7 is in practice, everything
that matters.

gpt show -l raid7 gives ...

       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34         990         
        1024     1047552      1  GPT part - "raid7a"
     1048576     2097152      2  GPT part - "USR_7"
     3145728     2097152      3  GPT part - "VAR_7"

(and lots more that isn't relevant).   I don't think the "trick" of
labelling the root partition this way is documented anywhere, I determined
it would work by reading the code.  I don't think it matters what its
index is, nor the offset from the start of the raid partition (at least,
not as far as being autoconfigured as root - booting is a whole different
issue.)

In /etc/fstab ....

NAME=raid7a		/		ffs	rw,log		 1 1
tmpfs		/tmp		tmpfs	rw,-m=1777,-s=537255936
NAME=SWAP_0		none		swap	sw,dp		 0 0
NAME=USR_7		/usr		ffs	ro		 1 2
NAME=VAR_7		/var		ffs	rw,log		 1 2

(and once again, lots more deleted here)

It really does all "just work" (for booting I do use a separate
partition - partly so the boot kernels can be normally unmounted, and
so less easily subverted - /netbsd is just for show, though it is the
same kernel as was booted, and partly because I'm too lazy to work out
how to set things up correctly so that the boot code will find the
/netbsd in one of the wedges that represents raid7a - but even that is
probably possible given suitable drive layout.)

To get the NAME= stuff and proper GPT config you need at least NetBSD 7
(the currently available beta thereof is fine) or current - while
wedges work on netbsd 6, they're way too painful to actually use, and
I wouldn't go near them on netbsd 5.

kre



Home | Main Index | Thread Index | Old Index