geom_mirror delayed synchronizing question

R. B. Riddick arne_woerner at yahoo.com
Wed Dec 27 09:57:26 PST 2006


--- "R. B. Riddick" <arne_woerner at yahoo.com> wrote:
> --- Christian Laursen <xi at borderworlds.dk> wrote:
> > No, -a and -n enables and disables autosynchronization. I want
> > autosynchronization but with a delay.
> >
> Then just issue "gmirror configure -a" by need (delayed; e. g. from
> /usr/local/etc/rc.d/gmirror-chk.sh) and disable it again, when sync is done
> (or
> started? I would have to test that...)...
> 
I have an even better idea (quick hack):

0. Turn off auto-sync: "gmirror configure -n <device name>"

1. we could schedule a gmirror-chk.sh execution every 5 minutes:
  */5 * * * * /root/gmirror-chk.sh
(note: crond is started after fsck)

2. /root/gmirror-chk.sh would look like this:
#!/bin/sh
gmirror status | grep / | cut -d/ -f2 | cut -d\  -f1 | \
while read dn ;do
  na=""
  fs=1
  gmirror list $dn | \
  while read ln ;do
    if [ `echo $ln | grep -c "^[1-9]"` -ne 0 ]; then
      if [ $fs -eq 1 ]; then
        fs=0
      else
        na=`echo $ln | cut -d\  -f3`
      fi
    elif [ ! -z "$na" ]; then
      if [ `echo $ln | grep -c "Flags: SYNCHRONIZING"` -ne 0 ]; then
        gmirror rebuild $dn $na
        break
      fi
    fi
  done
done

[TESTED OK R6.1]

-Arne

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the freebsd-geom mailing list