just destroy the swap snapshot and it doesn't get sent when you do a full send
2009/9/20 Frank Middleton <f.middle...@apogeect.com>: > A while back I posted a script that does individual send/recvs > for each file system, sending incremental streams if the remote > file system exists, and regular streams if not. > > The reason for doing it this way rather than a full recursive > stream is that there's no way to avoid sending certain file > systems such as swap, and it would be nice not to always send > certain properties such as mountpoint, and there might be file > systems you want to keep on the receiving end. > > The problem with the regular stream is that most of the file > system properties (such as mountpoint) are not copied as they > are with a recursive stream. This may seem an advantage to some, > (e.g., if the remote mountpoint is already in use, the mountpoint > seems to default to legacy). However, did I miss anything in the > documentation, or would it be worth submitting an RFE for an > option to send/recv properties in a non-recursive stream? > > Oddly, incremental non-recursive streams do seem to override > properties, such as mountpoint, hence the /opt problem. Am I > missing something, or is this really an inconsistency? IMO > non-recursive regular and incremental streams should behave the > same way and both have options to send or not send properties. > For my purposes the default behavior is reversed for what I > would like to do... > > Thanks -- Frank > > Latest version of the script follows; suggestions for improvements > most welcome, especially the /opt problem where source and destination > hosts have different /opts (host6-opt and host5-opt here) - see > ugly hack below (/opt is on the data pool because the boot disks > - soon to be SSDs - are filling up): > > #!/bin/bash > # > # backup is the alias for the host receiving the stream > # To start, do a full recursive send/receive and put the > # name of the initial snapshot in cur_snap, In case of > # disasters, the older snap name is saved in cur_snap_prev > # and there's an option not to delete any snapshots when done. > # > if test ! -e cur_snap; then echo cur_snap not found; exit; fi > P=`cat cur_snap` > mv -f cur_snap cur_snap_prev > T=`date "+%Y-%m-%d:%H:%M:%S"` > echo $T > cur_snap > echo snapping to sp...@$t > echo Starting backup from sp...@$p to sp...@$t at `date` >> snap_time > zfs snapshot -r sp...@$t > echo snapshot done > for FS in `zfs list -H | cut -f 1` > do > RFS=`ssh backup "zfs list -H $FS 2>/dev/null" | cut -f 1` > case $FS in > "space/<file system to skip here>") > echo skipping $FS > ;; > *) > if test "$RFS"; then > if [ "$FS" = "space/swap" ]; then > echo skipping $FS > else > echo do zfs send -i $...@$p $...@$t I ssh backup zfs recv -vF $RFS > zfs send -i $...@$p $...@$t | ssh backup zfs recv -vF $RFS > fi > else > echo do zfs send $...@$t I ssh backup zfs recv -v $FS > zfs send $...@$t | ssh backup zfs recv -v $FS > fi > if [ "$FS" = "space/host5-opt" ]; then > echo do ssh backup zfs set mountpoint=legacy space/host5-opt > ssh backup zfs set mountpoint=legacy space/host5-opt > fi > ;; > esac > done > > echo --Ending backup from sp...@$p to sp...@$t at `date` >> snap_time > > DOIT=1 > while [ $DOIT -eq 1 ] > do > read -p "Delete old snapshot <y/n> " REPLY > REPLY=`echo $REPLY | tr '[:upper:]' '[:lower:]'` > case $REPLY in > "y") > ssh backup "zfs destroy -r sp...@$p" > echo Remote sp...@$p destroyed > zfs destroy -r sp...@$p > echo Local sp...@$p destroyed > DOIT=0 > ;; > "n") > echo Skipping: > echo " "ssh backup "zfs destroy -r sp...@$p" > echo " "zfs destroy -r sp...@$p > DOIT=0 > ;; > *) > echo "Please enter y or n" > ;; > esac > done > > > > _______________________________________________ > zfs-discuss mailing list > zfs-discuss@opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss > _______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss