Beginner question on ZFS - Searching snapshots

Status
Not open for further replies.

JohnZFSUser

Cadet
Joined
Mar 29, 2014
Messages
2
If I use FreeNAS and ZFS to take a snapshot every evening of my FreeNAS files, and I want to restore to the previous version (or all previous versions) of a file (but I'm not sure when that was), is there a way to search through ZFS snapshots for the filename so I know which snapshot to 'clone' and get the most recent old version of the file out of?

Thanks!
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
And the .zfs directory may be invisible but it is there regardless.
 

JohnZFSUser

Cadet
Joined
Mar 29, 2014
Messages
2
Thank you!

I'll put some notes below in case they help other newbies. Being brand new to Freenas and ZFS here is what I figured out...

I typed: zfs list -t snapshot

and got:

NAME USED AVAIL REFER MOUNTPOINT test@manual-20140413 152K - 440K - test@manual-20140413b 156K - 444K -
And I figured out to get to the snapshot files location I had to type:

cd /mnt/test

And then to get in the invisible .zfs directory I typed:

cd .zfs

Then typed:

cd snapshot

And I could see my snapshot directories:
drwxr-xr-x 5 root wheel 5 Apr 13 12:46 manual-20140413 drwxr-xr-x 5 root wheel 5 Apr 13 12:46 manual-20140413b

And view the files in each of them.

So I guess to answer my own question, to find files in a snapshot, you might type something like:

cd /mnt/test/.zfs/snapshot

then type:

find . -name example-file-name.txt
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
You can also use "zfs diff" to see what has changed between two snapshots or a snapshot and the current state.
 
Status
Not open for further replies.
Top