periodic snapshots

Status
Not open for further replies.

ives31

Dabbler
Joined
Oct 17, 2014
Messages
33
Hi
I'm reading the manual and am trying to get to grips with freenas.
I've come across snapshots and am wondering if I should schedule them.
Presumably its a good idea.
However in not sure I cometely understand them.
I'm guessing from the manual that they can retrieve old deleted or corrupted files. Is that right?
Also, the manual says that if you keep an offsite back up, you can cometely restore a system (like windows restore, I guess?). My question is how can it do this without taking up a huge amount of space?
Thx
 
L

L

Guest
During a snapshot, it just updates the pointers so it doesn't take any space until changes are made. If you files don't change alot then it won't take up much space... You can go back and get an old version of a file or rollback the entire dataset.

As to replication, you do need an equal amount of storage for the second copy in the other systems.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Snapshots basically keep data from being wiped from disk when it is deleted or changed. For more details on this you need to look in to "Copy on Write" and ZFS in general.

The gist is that if you have a 1GB file and change the first byte, the majority of the file stays the same on disk and only the first block is rewritten. A snapshot holds onto the original block. You can then restore the original file from the snapshot.

If you have another ZFS pool somewhere, you can replicate snapshots from one pool to the other. You'd then have a complete copy of the replicated data in the other location. If the original pool is damaged, you can replicate the latest snapshot back and you haven't lost any data.

Snapshots only take up as much space as is needed to represent the changed data. Over time this can indeed add up to a lot of data. If you do enable snapshots (it's a really good idea) you need to make sure the snapshot frequency and expiration are such that you don't end up with a pool that is entirely taken up by old copies of data that you don't care about.

In my case, I take snapshots every five minutes and expire after something like two years. I use a custom script to expire the vast majority of them far earlier than that expiration. (Details here)

Before you start any of this you absolutely need to read up on ZFS, CoW, snapshots, and the dangers of letting your pool fill up.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
The first snapshot just references the same data that's on disk and takes **zero** additional space.

The first **replicated** snapshot will require as much space as the snapshot references.

Used, referenced, etc. are other terms you'll learn after researching how ZFS works.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
Of course, if you have users that like to randomly move files around and decide to rearrange a 3TB dataset without consulting you, your snapshots will start taking up lots of space very quickly. I expire snapshots at the 2-week mark and keep offsite tape backups for cold storage. Thankfully I work at a private company and so don't have to worry about Sarbanes-Oxley compliance. Unfortunately, OSHA prevents me from beating the aforementioned users with dead fish.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Just rearranging files shouldn't increase the snapshot size, unless the files are changing datasets.

Moving and renaming files doesn't involve changing data blocks, so the snapshot still references the same blocks on disk. The snapshot will increase in size a bit due to metadata changes, but that's very minor.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
Just rearranging files shouldn't increase the snapshot size, unless the files are changing datasets.

Moving and renaming files doesn't involve changing data blocks, so the snapshot still references the same blocks on disk. The snapshot will increase in size a bit due to metadata changes, but that's very minor.
Thanks for clarifying that. Heh. Learn new things every day. That's why I keep coming to these forums.
 
Status
Not open for further replies.
Top