On 4/15/07, Chris Gerhard <[EMAIL PROTECTED]> wrote:

While I would really like to see a zpool dump and zpool restore so that I
could throw a whole pool to tape it is not hard to script the recursive zfs
send / zfs receive.  I had to when I had to recover my laptop.

http://blogs.sun.com/chrisg/entry/recovering_my_laptop_using_zfs


I've been working on something similar:

#!/bin/bash

if [ $# -lt 1 ]; then
 echo "Usage: $0 tank"
 exit 0
fi

TANK=$1
DSTN="tank/sstore"

TIME=`date '+%Y-%m-%d-%H:%M:%S'`
zfs snapshot -r [EMAIL PROTECTED]


for  i in `zfs list -H | grep $TIME | cut -f1` ; do
 FS=`echo $i | cut -f1 -d'@'`
 LAST=`ssh ihstore zfs list -Ho backups:lastsend $DSTN/$FS 2> /dev/null`
 if [ $? == 1 ]; then
   echo "New $FS to $i"
   echo "  zfs send          $i | ssh ihstore zfs receive -v -d
$DSTN/$TANK"
   zfs send          $i | ssh ihstore zfs receive -v -d $DSTN/$TANK
   ERR=$?
   if [ $ERR != 0 ]; then echo "Error: $ERR for $i"; continue ; fi
   ssh ihstore zfs set backups:lastsend=$i  $DSTN/$FS
   continue
 else
   echo "$FS from $LAST to $i"
   echo "  zfs send -i $LAST $i | ssh ihstore zfs receive -F $DSTN/$i"
   zfs send -i $LAST $i | ssh ihstore zfs receive -v -F $DSTN/$i
   ERR=$?
   if [ $ERR != 0 ]; then echo "Error: $ERR for $i"; continue ; fi
   ssh ihstore zfs set backups:lastsend=$i  $DSTN/$FS
 fi
 echo "  zfs destroy $LAST"
 zfs destroy $LAST
 echo "done: $i"
 echo ""
done
_______________________________________________
zfs-discuss mailing list
[EMAIL PROTECTED]
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to