5

Is it possible to rollback to a certain directory within a snapshot? For example, given the snapshot tank/home@snapshot_week_01 can I rollback to something like tank/home/louis@snapshot_week_01 without rolling back all of the other files directories within tank/home?

2

To answer the question "Is it possible", the answer is no. ZFS snapshots have no concept of files, folders, or anything else, it is a block level snapshot of the entire filesystem.

You can however browse a snapshot and access individual files, as indicated in duenni's answer, or you can clone a snapshot giving you a second copy of the filesystem without rolling back the first.

7
+50

In this case I would go to /tank/home/.zfs/snapshot/snapshot_week_01 and pull out the data you need.

See Displaying and Accessing ZFS Snapshots on Oracle's website for details.

2

The answer to the question as asked is no; snapshots are per file system and you can only operate on the whole file system when working with the snapshot. So if you roll back to a previous snapshot, that affects the entire file system.

The way to restore specific files or directories from a ZFS snapshot is to navigate into the snapshot directory and then copy the files out of the snapshot, using something like cp -av snapshotfile /home/louis/myfile.

  • Many thanks! I didn't really understand duenni's answer until reading yours and @dasdfdsaq's. But looks like yours was a tiny bit later! – Louis Aug 14 '15 at 15:26
  • @Louis You're welcome; I'm glad I was able to help. (And while it's certainly your choice which answer to accept, you shouldn't feel pressured into accepting the answer that came first. Instead, you should accept the one that you found most helpful to you.) – a CVn Aug 14 '15 at 18:22
  • P.S. With a properly configured Samba setup on top of ZFS on Linux, you can also right click on a folder from a Windows client and use the "Previous versions" functionality – qasdfdsaq Aug 14 '15 at 23:40

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.