/[sysadmin-cookbook]/recepies/zfs/zfs-receive-snaphost.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /recepies/zfs/zfs-receive-snaphost.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 120 - (hide annotations)
Thu Jul 23 23:26:34 2009 UTC (14 years, 9 months ago) by dpavlin
File MIME type: application/x-sh
File size: 770 byte(s)
receive snapshot from other host using nc for low overhead

1 dpavlin 120 #!/bin/sh -x
2    
3     from=10.60.0.90
4    
5     fs=`ssh $from zfs list -t snapshot | grep @ | iselect -t "select snapshot to pull" -a | sed 's/ .*$//'`
6    
7     if [ -z "$fs" ] ; then
8     exit;
9     fi
10    
11     veid=`echo $fs | cut -d/ -f3 | cut -d@ -f1`
12     date=`echo $fs | cut -d/ -f3 | cut -d@ -f2`
13     pool=`echo $fs | cut -d/ -f1`
14    
15     echo "pull $pool / $veid @ $date"
16    
17     local=`zfs list | grep $veid | cut -d" " -f1`
18    
19     if [ -z "$local" ] ; then
20     local_pool=`zfs list | grep /backup/ | head -1 | cut -d/ -f1`
21     local="$local_pool/backup/$veid"
22     zfs create $local || exit
23     fi
24    
25     echo "clone $fs -- $veid to $local";
26    
27     ssh $from "zfs send $fs | nc -w 5 -l -p 8888" &
28     sleep 1
29    
30     nc $from 8888 | dd_rescue -w -y 0 -l /tmp/$veid@$data.log - - | zfs receive -F $local && zfs snapshot $local@$date
31    
32     zfs list -t snapshot | grep $veid

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26