We’ve already talked in deep about the features and the advantages of FreeNAS as storage resource: in this article we focus on how to create, use and restore snapshots in a very easy and practical ways.
A snapshot can be described as a “photography” of the storage state in a certain point in time that allows the so called “roll-back” to a previous situation. Thanks to the Copy-on-Write method of ZFS, described in the a previous article, snapshot operations are quick and take a few space. Starting from a functioning FreeNAS installation with a configured storage, the most common situation we encounter is a ZFS volume which is mapped to one or more shared network folders. Such shares can be attacked by a ransomware or can be simply accidentally or partially deleted. In a situation like this, the presence of properly configured snapshots can be a life-saving solution.
We’ll first analyse the required steps with FreeNAS, then we’ll cover the activities on the Windows client. First of all, we must enable the sharing service (CIFS) and create the folder to share: for the sake of simplicity in our example we’ll use just one folder that corresponds the entire storage available for this test.
After a share is created, we can enable the automated snapshot creation which can be planned by defining an execution window, how long they can be kept in memory, days of the week to run and the interval between failed attempts. From the list of performed snapshots we can choose, for each one, three main operations: cloning, deleting or doing the roll-back. This last option is the one we are interested in: it allows to restore storage exactly at the state it was when the snapshot was taken.
At this point we can go to the Windows client and verify the proper access to the network folders. We can directly observe the functioning of snapshots: after removing some folders we have performed a roll-back and in slide 5 we can note how the restore went on very well.
The example we’ve covered refers to a testing situation that is extremely simplified, but it’s a starting point for the setup in real production conditions with all the related difficulties. It’s important to specify that the management of permissions, folders, sub-folders and related snapshots can be way more granular that the one described in this article. FreeNAS allows the creation of Dataset and dedicated volumes (which can be used to create network shares with a total management of access privileges), each one with snapshot task and restore options.