How do i test recovering a file from a snapshot?

Status
Not open for further replies.

RichTJ99

Patron
Joined
Sep 12, 2013
Messages
384
Hi,

I want to take a file I dont need & delete it from the Freenas server. Then goto a snapshop to attempt a recovery.

I am curious what the proper steps (or if their is a guide) are for snapshot recovery.

Thanks,
Rich
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Clone the snapshot, share the clone, copy the file from the shared clone, unshare the clone, delete the clone.

If you use Windows and you exported a snapshot task you'll also be able to access the file from the "previous versions" in Windows without the need to create the clone etc.
 
Last edited:

m0nkey_

MVP
Joined
Oct 27, 2015
Messages
2,739
If you're using SMB shares, you can configure this to use Shadow Copies in Windows: http://doc.freenas.org/9.3/freenas_sharing.html#configuring-shadow-copies

Another method, although not highly recommended, there is a hidden directory known as .zfs you can go into while SSH'd into your FreeNAS box. Keep in mind this is not the correct way to do it. The correct way is to either roll-back the snapshot or write the snapshot to a new data set and share that.
 

RichTJ99

Patron
Joined
Sep 12, 2013
Messages
384
Clone the snapshot, share the clone, copy the file from the shared clone, unshare the clone, delete the clone.

If you use Windows and you exported a snapshot task you'll also be able to access the file from the "previous versions" in Windows without the need to create the clone etc.

Hi,

I went to my snapshots, found the one i wanted, checked the box, hit clone. Then went into storage, I can see the clone, I goto sharing, share the clone. I can then see the folder & when I go in it I see two directories (jails,Nas) which is correct. When I go into either of those two folders it is empty.

Any ideas what i did wrong?

Thanks,
Rich
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
The only thing I can think of is the permissions. Just use the most permissive permissions if you're unsure of what to put, it's only temporary so there's no security issue.

I personally done this twice in the past year so I'm 100 % sure it works :)
 

RichTJ99

Patron
Joined
Sep 12, 2013
Messages
384
I noticed that the snapshot by default doesnt check off the 'recursive' option. Could my snapshots only be getting the main directory with nothing inside it?
 

RichTJ99

Patron
Joined
Sep 12, 2013
Messages
384
Do you have your snapshot at the dataset level or the volume level?
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Recursive is for child datasets, not for directories, so it should work here if your directories aren't in fact datasets.

Can you post a screenshot of the volumes tab (in the storage section in the GUI) just to be sure of your datasets layout?

Snapshots always are at the dataset level AFAIK, the top-level dataset (second line in the volumes tab) is a dataset, not a volume (= pool, first line in the volumes tab).

I have some snapshots tasks on the root dataset with the recursive option enabled, and I have more frequent snapshots tasks on some of the sub-datasets with the recursive option disabled.
 

RichTJ99

Patron
Joined
Sep 12, 2013
Messages
384
Hi,

Please see attached - maybe i did this wrong?

Thanks,
Rich

snapshot1.JPG volumes.JPG
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
Ok they are recursive so it should work. Did you just changed them right now?

However if it wasn't recursive when the snapshot was taken it's normal that you don't have anything in NAS/ and jails/ because they are datasets, not directories.
 

RichTJ99

Patron
Joined
Sep 12, 2013
Messages
384
It looks like it is working properly. I see the following now in snapshots:

FNPool/jails/emby_1
FNPool/jails/Subsonic_1
FNPool/jails/virtualbox_1
FNPool/jails/.warden-template-Virtualbox-4.3.12
FNPool/jails/plexmediaserver_1
FNPool/jails/.warden-template-standard
FNPool/NAS/demodataset
FNPool/NAS
Pool/Storage

I did some test recovery of data. I dont really understand how the snapshot works, does it just save the changes from the original dataset & uses the existing (nonclone) dataset as the base?

Regardless snapshots seem to be working, tested, etc.

It seems like I should have some sort of backup off of this freenas box? While I have a raidz2 that only protects data integrity & is not a backup (right)?
 

Opentrends

Dabbler
Joined
Feb 17, 2016
Messages
11
Thanks Stux,
So If I understood right, I can clone a snapshot, then a new zvol will be created (clone) with no extra space consumed.
I can present this new zvol to my esxi server, copy some files. The space generated by this zvol will be only due to some modification in certain files.
And then I can freely remove the clone.

Is this a good procedure? In this way replication will run its course?
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,358
Status
Not open for further replies.
Top