ZFS snapshot send incremental

I have been happily using zfsnap with CentOS and ZFSonLinux in a scripted manner similar to how it is described on the web site, but have run into an issue. Unfortunately backups did not run a few days ago, and now I am stuck in an odd situation. I have a series of incremental backups on my backup ZFS server from my main ZFS server and some newer snapshots on the main server. Unfortunately due to the missed backup and automatic destruction of older snapshots on the main server there is no longer a common snapshot between the two systems to perform an incremental send with. i.e. on backup there is:

backuppool/x@snap2 
backuppool/x@snap3
backuppool/x@snap4

and on the main zfs server there is:

mainpool/x@snap6 
mainpool/x@snap7
mainpool/x@snap8

Is there any way to get them in sync again or do I have to destroy everything on backup and perform a full(there is not enough room for two full backups)? I tried specifying a send referencing the name of snap4 on the remote backup server from the main server, but as the main server does not have snap 4 it cannot calculate the incremental. I also tried to send snap4 from the backup to the main server, but it appears that the only way to do this would be to do it as a full send(not enough room), and I would need to wipe out existing snapshots. The deleting of all your backup history if you get snapshots mismatched seems pretty inconvenient, is there any solution in this scenario?


Solution 1:

As you have no common baseline snapshot in your setup, you will not be able to perform an incremental zfs send any longer. You would need to destroy the dataset in backuppool:

zfs destroy -r backuppool/x

and re-send the most recent snapshot to backuppool

zfs send mainpool/x@6 | [transfer magic] | zfs recv backuppool/x

The deleting of all your backup history if you get snapshots mismatched seems pretty inconvenient, is there any solution in this scenario?

The "solution" is simply to not delete source snapshots unless those snapshots have been verified to have transmitted successfully (i.e. show up in the remote's zfs list -tall output). I have no idea if zfsnap will support you with this, but even if it won't, you could use a shell script performing this kind of a check before letting zfsnap delete anything.