dannyman.toldme.com


FreeBSD, Technical

FreeBSD HOWTO: Software Mirror System Disk

A new feature of FreeBSD 5.3 is the ability to set up a software mirror of your system disk. This allows you to boot off either of a pair of hard disks, which will then function as a RAID1, which will ensure system uptime in the face of a single disk failure.

STOP THE PRESS! The instructions below work great, but I have just stumbled upon an easier way:
http://www.onlamp.com/pub/a/bsd/2005/11/10/FreeBSD_Basics.html

If, for some reason that doesn’t work for you so well, here’s my cheat sheet for setting this up with gmirror:

(This crib sheet assumes you have a pair of identical IDE (in my case, SATA) drives identified as ad4 and ad6.)

  1. Install FreeBSD on to ad4.
  2. Reboot with the Install CD.
  3. Enter Fixit mode. (For FreeBSD less than 5.4, use Install CD disc2 as the “live filesystem”)
  4. # chroot /dist
    # mount_devfs devfs /dev
    # gmirror load
    # gmirror label -v -b round-robin gm0 /dev/ad4
    # gmirror insert gm0 /dev/ad6
    # mount /dev/mirror/gm0s1a /mnt
    # echo ‘geom_mirror_load=”YES”‘ >> /mnt/boot/loader.conf
    # echo ‘swapoff=”YES”‘ >> /mnt/etc/rc.conf
  5. Edit /mnt/etc/fstab to convert ad4 -> mirror/gm0 (The ee command may be useful here – press ESC when you are done.)
    takhun suggests the following:
    # sed “s%ad4%mirror/gm0%” /mnt/etc/fstab > /mnt/etc/fstab.new
    # mv /mnt/etc/fstab.new /mnt/etc/fstab
  6. Reboot

Thanks to the few dozen people who have come before me, and posted crucial hints to the mailing lists. Thanks also to Ralf S. Engelschall who has a far more verbose explanation of how to do this sort of thing without console access and with mis-matched disks.

You should definately look over the gmirror man page, and review the output of gmirror list gm0 when swapping out drives. You can disable automatic rebuild, etc. It is quite nice.

Last note: If you need support with gmirror, Check out freebsd-questions — your question may be answered if you add a comment here, but asking on a mailing list will probably serve you best.

Share this:

Read More

Next:
Previous:
Categories: FreeBSD, Technical