Search
Social Profiles
Twitter Feed
Powered by Squarespace
« New Section Called Random Stuff | Main | Encryption Will Save Us All! »
Sunday
Mar082009

FreeBSD: System Disk Mirroring (Raid1)

I wanted to set up a Raid 1 Mirror of the boot disk on my newly installed FreeBSD system. For some reason I thought this would be hard but in reality it was only a few commands and an edit of the fstab file at the end of the system installation.

All these commands are used as ROOT and could destroy EVERYTHING.

The Following command gives the OS access to the disk.

# sysctl kern.geom.debugflags=17

Then we create the mirror array with the following command.

# gmirror label -vb round-robin gm0 /dev/ad0

We then add a line to the loader so that the mirror kernel module is loaded at boot time.

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

We have to find each /dev/ad0 entry in the fstab and change it to the mirror device. The original entries would look something like this /dev/ad0s1b. We need to take out each 'ad0' entry and replace it with '/mirror/gm0' as shown below.

/dev/mirror/gm0s1b

We then have to reboot the system to make sure the system will boot from the array.

# reboot

Then finally we add the second disk to the raid array, this will copy the contents of the first disk to the second and keep them synched.

# gmirror insert gm0 /dev/ad2

For more information the FreeBSD Handbook page on RAID1 Mirroring.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>