On Fri, Apr 16, 2010 at 01:54:45PM -0400, Edward Ned Harvey wrote:
> If you've got nested zfs filesystems, and you're in some subdirectory where
> there's a file or something you want to rollback, it's presently difficult
> to know how far back up the tree you need to go, to find the correct ".zfs"
> subdirectory, and then you need to figure out the name of the snapshots
> available, and then you need to perform the restore, even after you figure
> all that out.

I've a ksh93 script that lists all the snapshotted versions of a file...
Works over NFS too.

% zfshist /usr/bin/ls
History for /usr/bin/ls (/.zfs/snapshot/*/usr/bin/ls):
-r-xr-xr-x   1 root     bin        33416 Jul  9  2008 
/.zfs/snapshot/install/usr/bin/ls
-r-xr-xr-x   1 root     bin        37612 Nov 21  2008 
/.zfs/snapshot/2009-12-07-20:47:58/usr/bin/ls
-r-xr-xr-x   1 root     bin        37612 Nov 21  2008 
/.zfs/snapshot/2009-12-01-00:42:30/usr/bin/ls
-r-xr-xr-x   1 root     bin        37612 Nov 21  2008 
/.zfs/snapshot/2009-07-17-21:08:45/usr/bin/ls
-r-xr-xr-x   1 root     bin        37612 Nov 21  2008 
/.zfs/snapshot/2009-06-03-03:44:34/usr/bin/ls
% 

It's not perfect (e.g., it doesn't properly canonicalize its arguments,
so it doesn't handle symlinks and ..s in paths), but it's a start.

Nico
-- 
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to