GEOM

WebHome | UnixGeekTools | Geekfarm | About This Site

GEOM for FreeBSD

Pointers

GEOM Gate (ggate)

examples

    # info
    gmirror list
    gmirror status

    # remove GEOM mirror meta-data from disk
    $ gmirror clear /dev/ad0

    # add a disk to an existing mirror set
    sudo gmirror insert gm0 /dev/ad3

    # remove second disk from GEOM setup and remove GEOM mirror meta-data on it
    gmirror remove gm0 ad1

    # place a GEOM mirror label onto disk
    gmirror label -v -n -b round-robin gm0 /dev/ad1

    # activate GEOM mirror kernel layer
    # (makes the /dev/mirror/gm0 device available)
    gmirror load

Creating a new mirror

    # make sure the second disk is treated as a really fresh one
    # (not really necessary, but makes procedure more deterministically ;-)
    dd if=/dev/zero of=/dev/ad1 bs=512 count=79

    # place a GEOM mirror label onto second disk (actually on the
    # last block of the disk).  should probably use 'prefer' instead of
    # 'round-robin' and set priority to prefer local disk
    gmirror label -v -n -b round-robin gm0 /dev/ad1

    # activate GEOM mirror kernel layer
    # (makes the /dev/mirror/gm0 device available)
    gmirror load

    # place a PC MBR onto the second disk
    # (with a single FreeBSD slice /dev/mirror/gm0s1 covering the whole disk)
    fdisk -v -B -I /dev/mirror/gm0

    # place a BSD disklabel onto /dev/mirror/gm0s1
    bsdlabel -w -B /dev/mirror/gm0s1 # initialize
    # i generally take the default and use /gm0s1a as the whole disk
    bsdlabel -e /dev/mirror/gm0s1    # create custom partitions

    # newfs
    newfs -U /dev/mirror/gm0s1a

    # add to fstab:
    # /dev/mirror/gm0s1a            /export/gmirror01       ufs     rw              2       2
    mount /export/gmirror01

    # enable geom mirror in loader.conf
    echo 'geom_mirror_load="YES"' >>/boot/loader.conf

    # make sure the second disk is treated as a really fresh one
    dd if=/dev/zero of=/dev/ad3 bs=512 count=79

    # switch GEOM mirror to auto-synchronization and add first disk
    # (first disk is now immediately synchronized with the second disk content)
    gmirror configure -a gm0
    gmirror insert gm0 /dev/ad3

    # monitor sync progress
    while sleep 15; do echo -n "$(date): "; gmirror status | grep ad3; done





Updated Fri Feb 16, 2007 7:14 PM