zfs_versions of a file
By user12625760 on Jun 07, 2007
This post reminds me that I should have posted my zfs_versions script a while back. I did not as it had a theoretical bug where if you could move a new file into place which had the same age as the old file it would not see this as a new version. I've fixed that now at the expense of some performance and the script is called zfs_versions.
The script lists all the different versions of a file that live in the snapshots.
Here is the output:
: pearson FSS 124 $; /home/cjg/bin/sh/zfs_versions ~/.profile /tank/fs/users/cjg/.zfs/snapshot/month_09/.profile /tank/fs/users/cjg/.zfs/snapshot/smb2007-03-27-15:54/.profile /tank/fs/users/cjg/.zfs/snapshot/minute_2007-06-06-17:30/.profile : pearson FSS 125 $;
Compare this to the number of snapshots:
: pearson FSS 128 $; ls -1 ~/.zfs/snapshot/\*/.profile | wc -l 705 : pearson FSS 129 $;
So I have 705 snapshots that contain my .profile file but actually only three of them contain different versions.
The addition of the check to fix the theoretical bug slows down the script enough that the programmer in me could not let it lie. Hence I now have the same thing in TCL.