How can you tell if two ZFS snapshots are identical or simply named the same?
Say I have two computers named host-a
and host-b
. Also assume that host-a
has a ZFS dataset named /tank/mydataset
.
On host-a, I could: zfs snapshot tank/mydataset@mysnapshot' and then I could 'zfs send tank/mydataset@mysnapshot | ssh host-b zfs receive tank/mydataset
This would mean @mysnapshot
would be identical on both host-a
and host-b
.
On the other hand, on host-a
I could: zfs snapshot tank/mydataset@mysnapshot
followed by ssh host-b zfs snapshot tank/mydataset@mysnapshot
.
In this second case, the two snapshots are identically named, but the dataset may be wildly different.
Looking at the properties of tank/mydataset@mysnapshot
doesn't list any apparent way of identifying if the snapshots are identical--i.e. a GUID or hash.
Other than trying to take another snapshot of host-a
tank/mydataset@mysnapshot2
and trying to send to host-b
via zfs send -i @mysnapshot tank/mydataset@mysnapshot2 | ssh host-b zfs receive tank/mydataset
is there a way of determining that the snapshots are identical not only in name, but blocks?
There's a property specifically for this use-case.
zfs get guid pool/fs@snap
will give you a GUID (Globally Unique ID) for a snapshot. If the GUID doesn't match between two snapshots, one isn't replicated from the other, and they won't work as a basis for further incremental replication.This is also how syncoid identifies common snapshots to determine replication commands.
(Disclaimer: I am the initial developer and chief maintainer for the Sanoid project, which the Syncoid replication tool belongs to.)