2

I have the following ZFS dataset:

pool/dataset
pool/dataset@snap1
pool/dataset@snap2
pool/dataset@snap3

Which has been replicated to a backup pool, using ZFS send/recv

backupPool/dataset
backupPool/dataset@snap1
backupPool/dataset@snap2

Afterwards, I deleted dataset@snap1 and dataset@snap2 from pool, and I am in a situation where I cannot send dataset@snap3 incrementally to backupPool.

Is there a way of solving this situation? For instance, generate a ZFS incremental snapshot between pool/dataset@snap3 and backupPool/dataset@snap2 and send it to backupPool? Or transfer back backupPool/dataset@snap2 to pool?

I could transfer pool/dataset@snap3 to a new dataset in backupPool, but I really need to keep the "history" of snapshots.

  • Do you really need to have a ZFS dataset as a destination for your backups? It makes the whole concept difficult to manage. I have a similar setup for my backups. I just use serialized compressed snapshots with multiple incremental levels. – Martin Sugioarto Mar 6 at 7:56
  • Yes, I do need a ZFS dataset with the backup. – fclad Mar 6 at 15:24
  • 1
    @MartinSugioarto serialized compressed snapshots with multiple incremental levels That does leave you vulnerable to losing your backups entirely if you later have a problem with zfs receive. One advantage of immediately running zfs receive ... is that any issue is known immediately - not with you have to restore. – Andrew Henle Mar 7 at 10:34
  • Serialized snapshots can be only a problem, if you delete them in wrong order. Level 0 snapshots are most important, of course. The problem with live datasets is that if something accidentally writes to such a dataset, it's a totally different dataset from the logical point of view and you need to roll back. And if you delete a snapshot there, it's also a write access. On the sending side, if you delete a snapshot, all parent snapshots correct their diffs up to the top live filesystem and you lose any connection with you receiving dataset. This method appears very unstable to me. – Martin Sugioarto Mar 7 at 10:45
  • 1
    I subtlely misunderstood the question! @AndrewHenle's approach would work. When sending the new snapshot back to pool, you won't be able to do an incremental send, you just have to do a full send from scratch and create a new filesystem. By the way, if you deleted pool/dataset@snap2 to save space, you could try using bookmarks on the sending system instead of full snapshots -- they let ZFS know what changed since the last time you did a send, without keeping all of the data from that last snapshot around forever. – Dan Mar 8 at 3:08
0

Thank you for all your suggestions!

I finally rsynced pool/dataset@snap3 with backupPool/dataset@snap2, deleted the dataset backupPool/dataset, and recreated it from backupPool/dataset. I was not able to find a better solution to this problem.

The suggestion from Dan was really helpful. Also, to avoid deleting snapshots in the future it is a good practice to hold them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.