Snapshots - Have I been doing it wrong?

Status
Not open for further replies.

B34N

Dabbler
Joined
Jul 6, 2014
Messages
32
For the last two years I've had periodic snapshots recurring every two hours. I haven't had a need to rollback or clone a snapshot until last night when I mistakenly deleted some files. I caught my mistake immediately so I first tried to rollback the latest snapshot which was from before I deleted the files. Nothing seemed to happen so then I decided to clone the snapshot and then try to grab the files from there. Unfortunately my files were no where to be found. Only the top-level directories were listed with the exception of one recursive directory which happened to match the size of "refer" of the snapshot.

Am I now correct in my understanding that "Refer" is the total amount of data that is recoverable in that snapshot? So basically I've been running snapshots for years but of the wrong/incomplete data?

Fortunately the lost files are replaceable, so this is a "good way" to learn a lesson.

Thank you,
B34N
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
If you are on a windows box go to your freenas share and right click, select properties and then click on the previous versions tab. Do you have any previous versions listed there?
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
What is the Lifetime setting for your snapshots and how long had it been since that file was previously changed?
 

B34N

Dabbler
Joined
Jul 6, 2014
Messages
32
If you are on a windows box go to your freenas share and right click, select properties and then click on the previous versions tab. Do you have any previous versions listed there?

No windows machines, just linux. I unmounted and remounted the shares

What is the Lifetime setting for your snapshots and how long had it been since that file was previously changed?

2 weeks. This files are probably a year old.

Your questions is making me thin that I am misunderstanding what snapshots do? I thought that it would have a main snapshot and then incremental updates.
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,477
How are your snapshots setup exactly. Do you just have a snapshot been taken of the top level dataset and if so do you have the option "recursive" checked?
 

B34N

Dabbler
Joined
Jul 6, 2014
Messages
32
How are your snapshots setup exactly. Do you just have a snapshot been taken of the top level dataset and if so do you have the option "recursive" checked?

Where did that recursive come from? I must have missed it. No, it was not checked. Looking better now. Thank you!
 
Last edited:

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,477

B34N

Dabbler
Joined
Jul 6, 2014
Messages
32
Thank you for the help. I'll have to rethink how I want to setup snapshots and backups. Recursive is getting me too many things so I'll likely setup separate ones each with their own schedule.

My open question is: If I have not updated a particular file within the lifetime of the snapshots stored then can I still recover that file?
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,477
Sounds like a plan. You can definitely do separate snapshot schedules with differing times for snapshots to be held, etc.

I'm not sure I completely understand what your question but if the file was indeed captured on the initial snapshot taken (assuming recursive was checked if necessary) and the snapshot doesn't expire per rules setup, then yes, you should be able to recover.

Also please note that it is not generally recommended to "rollback". For future when you want to restore a file, you should always "clone", mount a share, copy what you need, then delete the cloned share.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,995
I don't use snapshots myself but if I were you, I'd test them out. I would create a series of test files and make some calendar reminders to delete a file and then try to recover it over a period of time. This will be the only way that "you" know it works.
 

mjt5282

Contributor
Joined
Mar 19, 2013
Messages
139
snapshots are really, really powerful and should be researched and implemented by most of our home users (because most probably lack tape backups). The ability to restore accidentally deleted or corrupt files is huge. The flexibility and the built-in scheduling and maintenance of old snaps is a great feature, too.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Also please note that it is not generally recommended to "rollback". For future when you want to restore a file, you should always "clone", mount a share, copy what you need, then delete the cloned share.
You can also restore files by copying them from the hidden "<dataset>/.zfs/snapshots" directory. Each snapshot will be listed and you can copy files directly.
 

fta

Contributor
Joined
Apr 6, 2015
Messages
148
Thank you for the help. I'll have to rethink how I want to setup snapshots and backups. Recursive is getting me too many things so I'll likely setup separate ones each with their own schedule.

I used to think this, but I've since realized it's much easier to set up recursive snapshots on my entire volume. There are much fewer snapshot schedules to deal with, and I know I have data recovery for every dataset. The only disadvantage to this is deletions will not happen until there are no snapshots referencing the data. In my case, that means for most datasets, deletions will not happen for 30 days. For datasets where I want retention longer than 30 days, I will set up snapshots specifically for that dataset.
 
Status
Not open for further replies.
Top