Setting Up RAID1 with GEOM on FreeBSD 8.1

After doing a default install I need to mirror my root hard drive. In the past I would have used ATA or CCD (Concatenated Disk Driver). I also have used Vinum which is a logical volume manager similar to Varitas Volume Manager or LVM in AIX. Reading though the notes and documentation I see that Vinum has been re-implemented as GEOM based and they have add a very easy subset called GEOM Mirror. That is what I went with.

All information and procedures was gleam from the always excellent FreeBSD Docs. There usually is no need to go else where, I find it convenient to distill the essential material down to these post purely for ease and convenience. These are instruction that while generally true are geared towards what I am doing.

Mirroring Whole Disks

  • Before building the mirror, enable additional debugging information and opening access to the device by setting the kern.geom.debugflags. sysctl kern.geom.debugflags=17
  • Begin the process by storing meta-data information on the primary disk device. gmirror label -vb round-robin gm0 /dev/da0

    Warning: Creating a mirror out of the boot drive may result in data loss if any data has been stored on the last sector of the disk.

  • load the /boot/kernel/geom_mirror.ko kernel module gmirror load
  • Enable loading of the geom_mirror.ko kernel module during system initialization echo 'geom_mirror_load="YES"' >> /boot/loader.conf
  • Edit the /etc/fstab file, replacing references to the old da0 with the new device nodes of the gm0 mirror device.
  • Reboot the system
  • Using the mount command check the gm0 is being used.
  • Add your second disk gmirror insert gm0 /dev/da1
  • Check status with gmirror status
This entry was posted in FreeBSD -- Setup, UNIX. Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.