Bootable RAID10 on 9.0-RELEASE

Ravi Pokala rp_freebsd at mac.com
Sat Jan 28 09:23:48 UTC 2012


Hi folks,

I'm putting together a server, and I want to balance performance and
reliability by putting everything on a four-disk RAID10 array.

        +----------+    +----------+    +----------+    +----------+
        |   da0    |    |   da1    |    |   da2    |    |   da3    |
        |          |    |          |    |          |    |          |
        |          |    |          |    |          |    |          |
        |          |    |          |    |          |    |          |
        |          |    |          |    |          |    |          |
        +----------+    +----------+    +----------+    +----------+

Based on past experience with creating mirrored roots on older versions
(but with the added complexity of the stripes), I would expect the
procedure to look something like this, but I would like confirmation
and/or corrections:

1) Install the base system on a spare drive:

        +-----------------------------------+
        |   dad0p1  freebsd-boot    loader  |
        +-----------------------------------+
        |   dad0p2  freebsd-ufs     /       |
        +-----------------------------------+
        |   dad0p3  freebsd-swap    swap    |
        +-----------------------------------+
        |   dad0p4  freebsd-ufs     /var    |
        +-----------------------------------+
        |   dad0p5  freebsd-ufs     /usr    |
        +-----------------------------------+

2) Boot said drive to single-user mode.

3) Use `geom part' to create appropriately sized partitions on each of the
drives for the RAID.

        +----------+    +----------+    +----------+    +----------+
        |   da0p1  |    |   da1p1  |    |   da2p1  |    |   da3p1  |
        +----------+    +----------+    +----------+    +----------+
        |   ...    |    |   ...    |    |   ...    |    |   ...    |
        +----------+    +----------+    +----------+    +----------+
        |   da0pN  |    |   da1pN  |    |   da2pN  |    |   da3pN  |
        +----------+    +----------+    +----------+    +----------+

4) Load the mirror driver:

    geom mirror load

5) Create the mirrors:

    geom mirror label [-b load?] gm0p1 /dev/da0p1 /dev/da1p1
    ...
    geom mirror label [-b load?] gm0pN /dev/da0pN /dev/da1pN
    geom mirror label [-b load?] gm1p1 /dev/da2p1 /dev/da3p1
    ...
    geom mirror label [-b load?] gm1pN /dev/da2pN /dev/da3pN

        +--------------------------+    +--------------------------+
        |       +----------+       |    |       +----------+       |
        | gm0p1 |   da0p1  |\      |    | gm1p1 |   da2p1  |\      |
        |       +----------+ \     |    |       +----------+ \     |
        | ...   |   ...    |\|\    |    | ...   |   ...    |\|\    |
        |       +----------+ \ +   |    |       +----------+ \ +   |
        | gm0pN |   da0pN  |\|\|   |    | gm1pN |   da2pN  |\|\|   |
        |       +----------+ \ +   |    |       +----------+ \ +   |
        |       \           \|\|   |    |       \           \|\|   |
        |        \~~~~~~~~~~~\ +   |    |        \~~~~~~~~~~~\ +   |
        |         \   da1pN   \|   |    |         \   da3pN   \|   |
        |          +-----------+   |    |          +-----------+   |
        +--------------------------+    +--------------------------+

6) Load the stripe driver:

    geom stripe load

7) Create the stripes:

    geom stripe label gs0p1 /dev/mirror/gm0p1 /dev/gm1p1
    ...
    geom stripe label gs0pN /dev/mirror/gm0pN /dev/gm1pN

        +--------------------------------------+
        |       +----------+    +----------+   |
        | gs0p1 |   gm0p1  |    |   gm1p1  |   |
        |       +----------+    +----------+   |
        +--------------------------------------+
        |       +----------+    +----------+   |
        | ...   |   ...    |    |   ...    |   |
        |       +----------+    +----------+   |
        +--------------------------------------+
        |       +----------+    +----------+   |
        | gs0pN |   gm0pN  |    |   gm1pN  |   |
        |       +----------+    +----------+   |
        +--------------------------------------+

8) Create filesystems on the stripes:

    newfs -J -U /dev/stripe/gs0p1
    ...
    newfs -J -U /dev/stripe/gs0pN

9) Remount / and /boot to read-write, edit /etc/fstab to change all
references to /dev/dad0 to /dev/stripe/gs0, edit /boot.loader.conf to add
the loading of the mirror and stripe modules at boot, and change back to
read-only.

10) Copy all files from dad0pN to gs0pN.

11) Reboot

12) Victory!

Somehow, I suspect I'm wrong. In fact, I really hope I'm wrong - RAID10 is
such a common configuration, I expect there must be an easier way.

Thanks,

rp




More information about the freebsd-geom mailing list