restore from zfs incremental backup

Solution 1:

As your incr5 backup was taken against the full backup (ie: by issuing zfs snapshot pool/mydata@incr5; zfs send -i pool/mydata@fullback pool/mydata@incr5 > /backup/incr5) you can not restore it against another backup - namely incr2. To restore incr5 you need to restart from a "plain" fullback restore.

In other words, you are not really using incremental backups, rather differential ones. For the latter, you need to always start from the last full backup.

Alternatively, you can switch to true incremental backup basing each new snapshot on the one before with something as the following:

zfs snapshot pool/mydata@fullback; zfs send pool/mydata@fullback > /backup/fullback
zfs snapshot pool/mydata@incr1; zfs send -i pool/mydata@fullback pool/mydata@incr1 > /backup/incr1
zfs snapshot pool/mydata@incr2; zfs send -i pool/mydata@incr1 pool/mydata@incr2 > /backup/incr2
zfs snapshot pool/mydata@incrN; zfs send -i pool/mydata@incrN-1 pool/mydata@incrN > /backup/incrN

For more information and advices on a reliable backup chain, I strongly suggest you to read here and here

Solution 2:

Essentially it depends on whether you want to restore an entire snapshot (i.e. all the files in it) or one or more files within the backup.

In the second case (the one in which you essentially want to resume foo.doc, without the need to restore gigabytes of data) you can adopt a different mechanism: "freeze" the snapshots within a single archive (file), and then restore from the latter, in a similar way to how you would do with 7z or rar to understand with an example (a "snapshotted-7z/tar/whatever").

In your example I don't see a replica, but a real file-based backup (i.e. the zfs streams redirected to file).

If you use a FreeBSD system you can find a program already in the ports (archivers \ paq), it is called zpaq.

Otherwise you can try the latest version (7.15) or any more updated forks