How to you find the parent snapshot of a zfs clone

filesystemszfs

I made a clone of zfs filesystem that has a number of snapshots. I also have several replicated copies of the filesystem.

How can I find which filesystem/snapshot a clone is attached to?

(Seems like something that should be in the docs/googlable but I haven't found anything)

Best Answer

There is a special property called origin which holds what you need. Let's assume we have a zpool tank and a filesystem tank/f1 and we create a snapshot and a clone:

 zfs snapshot tank/f1@s1
 zfs clone tank/f1@s1 tank/f2

Let's check the origin of that clone:

zfs get origin tank/f2

Output:

NAME     PROPERTY  VALUE       SOURCE
tank/f2  origin    tank/f1@s1  -