FreeBSD : How to setup a software RAID-1

By | November 10, 2011

First, avoid any problem by getting two identical hard drive (or at least, same size and speed at least if not from same manufacturer).

This tutorial assume both your hard disk are “da0” and “da1“. If you don’t know you’re devices name, simply use “dmesg” or “df -h” command to find out.

First, let’s temporary disable the security feature that indicate the primary disk is mounted and in use :

Let’s start making the mirror device :

Tell the OS to load geom at startup :

We need to edit fstab to tell FreeBSD to use the mirror device, so I suggest making a backup of the original file before edit :

Here a sample of /etc/fstab before modification :


We need to change the devices to “/dev/mirror/gm*“. There is how the stab file look like after being modified :

Ok, almost done. You may reboot you’re system now. Make sure there is no error in fstab, because you’re system may not boot! If it happen, this is not a big deal, use the FreeBSD boot CD, and use the Fixit option to correct you’re mess!

Once you’re system is rebooted, synchronize the mirror using this command :

You can follow the sync with this command :

Be Sociable, Share!