# ZFS: Possible to replicate missing snapshot?



## littlesandra88 (Apr 4, 2013)

Hello =)

If I do


```
zfs create tank/fs
zfs snapshot tank/fs@snap
zfs send tank/fs@snap | zfs receive tank2/fs
```
then the filesystem fs gets created as part of the replication to tank2.

If I now by mistake destroy the snapshot on tank2
`# zfs destroy tank2/fs@snap`

*Question*

Is it then possible to replicate the snapshot over again? Or is the only option to destroy tank2/fs and then replicate again from the beginning?


----------



## usdmatt (Apr 4, 2013)

I can't see any way ZFS can re-create the snapshot on the receiving side without sending the whole file system again. All the magic of sending incremental data is based on those matching snapshots, once you've deleted the snapshot ZFS has no frame of reference to re-create it or do any further incremental transfers. As far as ZFS is concerned they may as well be completely different file systems (and obviously you won't fool it by creating a snapshot manually with the same name).


----------



## littlesandra88 (Apr 4, 2013)

That makes sense.

So the only solution is to

`# zfs destroy -r tank2/fs`

and then start over?


----------



## phoenix (Apr 4, 2013)

littlesandra88 said:
			
		

> Hello =)
> 
> If I do
> 
> ...



Just resend the snapshot.  So long as it's the last snapshot on fs2 that was deleted, just sending that snapshot again will be enough.

If you send snap1 through snap4, and then delete snap3 from fs2, you would need to also delete snap4, and then re-send snap3 and snap4.

No need to completely destroy fs2.


----------



## littlesandra88 (Apr 4, 2013)

@phoenix

If I send it again with the same command

`# zfs send tank/fs@snap | zfs receive tank2/fs`

then zfs complains about that the filesystem already exists.

So I was under the impression, that zfs had to create the filesystem on the destination side, the the first snapshot is replicated. And if I loose this first snapshot, then I would have to destroy tank2/fs.

How would you send the snapshot, when the filesystem already is on the destination pool?


----------



## usdmatt (Apr 5, 2013)

Obviously if you have historic snapshots, snap1, snap2, snap3, and you delete snap3, you can just resend snap3 from the source, using snap2 as the 'incremental base'.

The original question showed a system with only one snapshot. After deleting this there would be no snapshots at all on the destination. I see no way of continuing to do incremental backups to that file system without resending the whole thing.


----------



## AndyUKG (Apr 5, 2013)

littlesandra88 said:
			
		

> How would you send the snapshot, when the filesystem already is on the destination pool?



[cmd=]zfs receive -F[/cmd] I think will do it...


----------

