Setup Snapshots in FreeNas 11.2
Understanding snapshots and rollbacks in FreeNas 11.2. Step by Step Guide
By Fahad Usman
Understanding snapshots and rollbacks in FreeNas 11.2 Stable RELEASE is very important. It shows the real power of ZFS file system. After the initial snapshot, the new snapshots don’t actually copy over new/added/modified files over, but take a “deferential” of the original snapshot resulting in massive reduction in size of the subsequent new snapshots but also takes seconds to record new snapshots and therefore enhancing system performance.
Snapshots can be understood as a “bookmark”. It bookmarks your data in that dataset (or zvol) at that particular moment. That data will then be preserved until you delete all of the bookmarks that protect that data. If all bookmarks protecting that data are removed, then you end up with the only copy in existence being the copy that is “real-time”. If there is no “real-time” copy of that data, then when the last bookmark was deleted, that disk space was freed at that time.
You can get back to the most recent snapshot by cloning or rolling back.
“Think of snapshots as fast and efficient process of restoring a file/directory to a previous/original version or a state”
You can get back to *any* snapshot by cloning it. Cloning is like “mounting” a snapshot in a new location (you have to provide that location when cloning the snapshot).
Let’s get into it. I am going to create a test dataset and then setup a periodic snapshot for this dataset. Then will add files to it and show you how to rollback to the previous state/version of the dataset.
You can create the dataset like this:
Now that we have a test dataset to play with. We are going to setup a Windows SMB share in order to access this dataset in Windows and Mac. This is just to add new files to the dataset in an easy way! Create a share by following this:
Now that we got our testDataset and shares ready. Let’s put some data in the testDataset that we want to take the snapshot off. Open up the browser and browse to the testDataset location and put couple of files there.
And now setup manual snapshot of the testDataset.
Note: I normally create a periodic snapshots. But doing a manual so that we don’t have to wait for the period to be up before it takes a snapshot of the dataset. So here is how you take a manual snapshot:
Now if you can’t see an option to Rollback then you can make a “Clone” of the manual snapshot. This will appear under your datasets. You will have to then create a separate share for this dataset in order to access files. Copy those back to the original dataset where you lost the files and delete the cloned dataset. In order to create a periodic snapshots of this dataset. This is what you will have to do to take a daily periodic snapshot of this dataset every 1 hour/7 days a week and once the system has taken a snapshot once the hour is up, you can access it in the same snapshots place as manual snapshot:
Storage -> Snapshots
Remember the following points:
- You need to take periodic snapshots in order to “rollback” to the previous state/version of the dataset.
- If there is no rollback option available when clicking on the “three dots” next to a particular snapshot, then you will have to mount it by cloning the snapshot and then creating a share.
- if you change any settings of the dataset and roll back then the previous settings will re-appear
Hope this helped! Until next time!