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.

This is pretty good, but it could be better.  The solution should be
cross-platform compatible, because the user who wishes to perform such
operations may be working across an NFS or CIFS mountpoint.

If something like this already exists, please let me know.  Otherwise, I
plan to:

Create "zfshistory" command, written in python.  (open source, public, free)
zfshistory would have the following subcommands:
    ls        list snapshots that contain the specified file or directory
    cp        copies a file or directory from a past snapshot to a new name
              in the current version of the filesystem
    rollback  delete the present version of a named file or directory, and 
              replace it with the specified past snapshot version
    locate    list complete paths to all the snapshot versions of
              the specified file or directory

Example usage:
rm somefile
(Whoops!)
zfshistory ls somefile
  somef...@frequent-2010-04-16-12-45-00
  somef...@frequent-2010-04-16-12-30-00
  somef...@frequent-2010-04-16-12-15-00
  somef...@frequent-2010-04-16-12-00-00
  somef...@hourly-2010-04-16-12-00-00
zfshistory cp somef...@frequent-2010-04-16-12-45-00 ./mynewfilename
zfshistory rollback somefile
  (restores somefile to the latest snapshot available)
zfshistory rollback somef...@frequent-2010-04-16-12-00-00
  (restores somefile to the specified snapshot)
zfshistory locate somefile
  /tank/.zfs/snapshot/frequent-2010-04-16-12-45-00/home/username/somefile
  /tank/.zfs/snapshot/frequent-2010-04-16-12-30-00/home/username/somefile
  /tank/.zfs/snapshot/frequent-2010-04-16-12-15-00/home/username/somefile
  /tank/.zfs/snapshot/frequent-2010-04-16-12-00-00/home/username/somefile
  /tank/.zfs/snapshot/hourly-2010-04-16-12-00-00/home/username/somefile

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

Reply via email to