GMirror on FreeBSD 6.x/7.x/8.x

   Gmirror is a software raid mirror system.  It allows to disks or partitions to be mirrored so that in the even of a total drive failure, you can switch over to the mirrored drive. This example will go through how to setup to drives in a mirrored configuration.

    This install assumes that you have two identical drives installed as the first and second IDE drives (/dev/ad0 and /dev/ad1). If you are usin SCSI drives or the drives are mounted on different controllers then modify the device names below as needed.

Setting up the RAID

    Install FreeBSD for the install CD as normal on the first drive. Select “Standard MBR” and setup your partitions as you wish with the sysinstall program. Setup your passwords and timezone but before the reboot at then end, press F4 to switch to the “Emergence Holographic” shell and enter the following commands.

# sysctl kern.geom.debugflags=16
# gmirror label -v -b round-robin gm0 /dev/ad0

    Edit /etc/fstab and change all the ad0 references to gm0 and insert the word mirror between the directory and the device. For example.. /dev/ad0s1 => /dev/mirror/gm0s1a

    Run the following command to make sure that gmirror starts up on boot.

# echo geom_mirror_load=\"YES\" >> /boot/loader.conf

    Switch back to the main screen (F1) and exit sysinstall.  Reboot

    Add the second drive in once it has come up with the following command.

# gmirror insert gm0 /dev/ad1

Checking the Raid

    You can now list the gmirror raid configuration and see what is going on with the following command.

# gmirror list | more

    Note: The SYNCHRONIZING on the Flags line. It will take a while for the two drives to synchronize. The bigger the drive the longer it takes to sync.

    To see the percentage of syncronization you can use the following command.

# gmirror status

Leave a Comment

Your email address will not be published. Required fields are marked *