Skip to content

Instantly share code, notes, and snippets.

@johnko
Last active November 25, 2015 21:43
Show Gist options
  • Save johnko/04051c22cceac1fc85be to your computer and use it in GitHub Desktop.
Save johnko/04051c22cceac1fc85be to your computer and use it in GitHub Desktop.
ZFS Divergence of Snapshots experiment
Script started on Wed Nov 25 20:15:39 2015
# sh test.sh
+ zfs create tank/pool1
+ zfs snap tank/pool1@now
+ zfs send tank/pool1@now
+ zfs recv tank/pool2
+ hostname
+ zfs snap tank/pool1@a
+ date
+ zfs snap tank/pool2@b
+ echo 'snaps are diverged, can we send?'
snaps are diverged, can we send?
+ zfs send -I tank/pool1@now tank/pool1@a
+ zfs recv tank/pool2
cannot receive incremental stream: destination tank/pool2 has been modified
since most recent snapshot
+ echo 'maybe we can clone then send?'
maybe we can clone then send?
+ zfs clone tank/pool2@now tank/poolshared
+ zfs send -I tank/pool1@now tank/pool1@a
+ zfs recv tank/poolshared
cannot receive incremental stream: most recent snapshot of tank/poolshared does not
match incremental source
+ echo 'doesn'\''t look like we can merge diverged snaps. we can only rollback the one we want to destroy or create a new dataset'
doesn't look like we can merge diverged snaps. we can only rollback the one we want to destroy or create a new dataset
+ echo 'summary list of snaps'
summary list of snaps
+ zls -r tank/pool1
NAME USED REFER CREATION
tank/pool1@now 64K 96K Wed Nov 25 20:15 2015
tank/pool1@a 0 96K Wed Nov 25 20:15 2015
+ zls -r tank/pool2
NAME USED REFER CREATION
tank/pool2@now 64K 96K Wed Nov 25 20:15 2015
tank/pool2@b 0 96K Wed Nov 25 20:15 2015
+ zls tank/poolshared
cannot open 'tank/poolshared': operation not applicable to datasets of this type
+ zl tank/poolshared
NAME USED AVAIL REFER USEDCHILD USEDSNAP QUOTA CANMOUNT MOUNTED MOUNTPOINT CREATION
tank/poolshared 8K 591G 96K 0 0 none on yes /tank/poolshared Wed Nov 25 20:15 2015
+ zfs destroy tank/poolshared
+ zfs destroy -r tank/pool1
+ zfs destroy -r tank/pool2
+ exit
# exit
exit
Script done on Wed Nov 25 20:15:54 2015
#!/bin/sh
set -x
zfs create tank/pool1 ; zfs snap tank/pool1@now
zfs send tank/pool1@now | zfs recv tank/pool2
hostname > /tank/pool1/file
zfs snap tank/pool1@a
date > /tank/pool2/file
zfs snap tank/pool2@b
echo "snaps are diverged, can we send?"
zfs send -I tank/pool1@now tank/pool1@a | zfs recv tank/pool2
echo "maybe we can clone then send?"
zfs clone tank/pool2@now tank/poolshared
zfs send -I tank/pool1@now tank/pool1@a | zfs recv tank/poolshared
echo "doesn't look like we can merge diverged snaps. we can only rollback the one we want to destroy or create a new dataset"
echo "summary list of snaps"
zls -r tank/pool1
zls -r tank/pool2
zls tank/poolshared
zl tank/poolshared
zfs destroy tank/poolshared
zfs destroy -r tank/pool1
zfs destroy -r tank/pool2
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment