Method to mirror a single partition across the net

Steve Kargl sgk at troutmask.apl.washington.edu
Wed Nov 5 20:25:16 PST 2008


I was directed on freebsd-questions to ask my question on
freebsd-fs, but freebsd-geom is perhaps a mosre appropriate
list.

I've read the Handbook's chapter on GEOM, gmirror(1), geom(8), ggated(8),
and ggatec(8), and I've search the web for a solution to the following
issue.

I would like to mirror a single partition on system A to a partition on
system B.  It would appear a combination of gmirror and ggated would work,
but I haven't found any example on setting up two systems.

To be specific, /etc/fstab on the 2 systems is 

# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad4s1b             none            swap    sw              0       0
/dev/ad4s1a             /               ufs     rw              1       1
/dev/ad4s1e             /data           ufs     rw              2       2
/dev/ad4s1d             /usr            ufs     rw              2       2

I want to mirror 192.168.0.20:/dev/ad4s1e to 192.168.0.21:/dev/ad4s1e

Does the following method work?

On 192.168.0.21:

  # umount /dev/ad4s1e
  # echo "192.168.0.21/24 RW /dev/ad4s1e" > /etc/gg.exports
  # ggated

On 192.168.0.20:

  # ggatec create -o rw 192.168.0.21 /dev/ad4s1e
  # gmirror label  data /dev/ad4s1e
  # gmirror insert data /dev/ggate0

and /etc/fstab becomes

# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad4s1b             none            swap    sw              0       0
/dev/ad4s1a             /               ufs     rw              1       1
/dev/ad4s1d             /usr            ufs     rw              2       2
/dev/mirror/data        /data           ufs     rw              2       2

This also leads to the question that if one is (or both systems are)
rebooted, does the mirror automagically come back on boot? 

-- 
Steve


More information about the freebsd-geom mailing list