Software RAID-1 with FreeBSD

Prior to FreeBSD 6 if you wanted to mirror your hard drives you could use Vinum to get the job done. However it was not possible to actually mirror the root partition because of the way the boot loader worked. Now with the introduction of gmirror it's possible to easily mirror your system hard drive without having to worry about your root partition.

# sysctl kern.geom.debugflags=16
kern.geom.debugflags: 0 -> 16

gmirror label -v -b round-robin gm0 /dev/ad0

Metadata value stored on /dev/ad0

echo geommirrorload="YES" > /boot/loader.conf

vi /etc/fstab

Change each ad to a gm, and insert a mirror after /dev. For example, /dev/ad0s1a becomes /dev/mirror/gm0s1a. Unless you've made extra partitions, you'll have ad0s1 devices ending in a, b, d, e, and f and will need to edit each of those lines.


gmirror insert gm0 /dev/ad2

GEOMMIRROR: Device gm0: provider ad2 detected.
MIRROR: Device gm0: rebuilding provider ad2.

gmirror list | more

gmirror status

See: — Using Software RAID-1 with FreeBSD for more information.