software raid

Modulok modulok at gmail.com
Tue Feb 7 18:34:55 UTC 2012


> Does FreeBSD support any type of software raid?
> I have an old rack mount server which has 8 bays, but all SATA,
> and NO raid. Sure would be nice to have a software raid
> to create a NAS device.

Yes!

An example of setting up a 3 disk raidz might look like this:

    zpool create myfancyraid raidz ad4 ad6 ad8
    zfs create myfancyraid/foo
    zfs set mountpoint=/usr/foo myfancyraid/foo
    zfs mount -a
    cd /usr/foo
    echo "hello world" > hello.txt

Yay! Then edit /etc/rc.conf to enable zfs at boot time:

    echo 'zfs_enable="YES"' >> /etc/rc.conf


How's my raid doing today? Cake:

    zpool status
    zfs list

You can even mix and match raid and encryption. Below, I put a raidz on top a
geli encryption layer on three devices. (There are other ways to do this too.)
When it comes time to decommission disks, there's no company data leaks
(depending on your needs):

    # Create the geli:
    geli init -b -e AES -l 256 /dev/ad4
    geli init -b -e AES -l 256 /dev/ad6
    geli init -b -e AES -l 256 /dev/ad8

    # Attach it or reboot:
    geli attach ad4
    geli attach ad6
    geli attach ad8

    # Make the zpool and Z file system:
    zpool create myfancyraid raidz ad4.eli ad6.eli ad8.eli
    zfs create myfancyraid/foo
    zfs set mountpoint=/usr/foo myfancyraid/foo
    zfs mount -a

Then edit /boot/loader.conf to load geli at boot time::

    echo 'geom_eli_load="YES"' >> /boot/loader.conf

Finally, add the bit about ZFS to /etc/rc.conf::

    echo 'zfs_enable="YES"' >> /etc/rc.conf

You'll be asked for the password to each provider (disk) at boot time before
the system enters multi-user mode. Make sure you have console access
and a backup copy of the password somewhere!

A word on graid3: For a multi-user file server, serving lots of small requests,
graid3 is about the worst performance you can get due to its raid3 nature.
Requests have to be served sequentially, using all disks in the array.
Slow in my experience.

Good luck!
-Modulok-


More information about the freebsd-questions mailing list