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)


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


tank/f2  origin    tank/f1@s1  -

Depends on your zfs list output... but you can also look at the output of: zpool history to see the command sequences and actions (manual and automated) performed on the pool. That may help refresh your memory. Filter for clone commands if there's too much output.

[root@GreenLeaf ~]# zpool history
History for 'vol0':
2013-09-14.16:57:19 zpool create -o ashift=12 vol0 fioa
2013-09-14.16:57:26 zfs create vol0/ppro2
2013-09-14.16:57:32 zfs set recordsize=32K vol0/ppro2
2013-09-15.14:52:08 zfs create -s -V 750G vol0/pprovol
2013-09-15.14:55:23 zfs destroy vol0/pprovol
2013-09-15.14:58:06 zfs create -o volblocksize=64K -s -V 750G vol0/pprovol

History for 'vol1':
2012-12-31.16:13:01 zpool create -f vol1 /dev/sdb
2012-12-31.16:13:22 zfs create vol1/ppro
2012-12-31.16:13:47 zfs set atime=off vol1/ppro
2012-12-31.16:13:55 zfs set compress=on vol1/ppro
2012-12-31.16:15:05 zfs set mountpoint=/ppro vol1/ppro
2012-12-31.21:07:37 zfs create vol1/pproold
2012-12-31.21:08:17 zfs set compress=gzip-9 vol1/pproold
2012-12-31.21:08:53 zfs set mountpoint=/ppro/pproold vol1/pproold
2012-12-31.22:20:56 zfs create vol1/ppro1
2012-12-31.22:21:12 zfs set compress=gzip-9 vol1/ppro1
2012-12-31.22:21:32 zfs set mountpoint=/ppro/ppro1 vol1/ppro1
2013-01-01.11:15:07 zpool set autoexpand=on vol1

Another simple method:

zfs list -o name,origin | egrep ".@."

and without rpool:

zfs list -o name,origin | egrep -v "^rpool" | egrep ".@."
  • ... and zfs list -o name,origin | grep -v ' -$' if you want to keep the headers ) – ジョージ Oct 16 '20 at 7:58

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.