On TrueNAS, “snapshots” is a ZFS feature, which allows you to protect your data, and in this guide, you will learn steps to create, close, rollback, and delete snapshots on TrueNAS Core, but the steps should also work for TrueNAS Scale.
If you want to understand snapshots, we must step back and define ZFS. At the core of TrueNAS, you will find ZFS, a file system that manages how files are stored on the drives. Unlike a traditional file system, ZFS uses objects, and everything is considered a pointer. In other words, when you create a dataset on TrueNAS, you only have a system of pointers to the file location. When a file gets modified, instead of deleting the file, ZFS will save the modifications to a different part of the drive, and then it creates a pointer to that part of the storage and preserves the original version of the file.
In a nutshell, a snapshot is basically a copy of pointers taken at a specific time that doesn’t consume a lot of storage, and you can use it to restore files relatively fast because you are not restoring data. You are simply reconfiguring the pointers. Since you can create multiple snapshots, you can have multiple versions of files.
This guide will teach you the steps to use snapshots on TrueNAS.
- Create snapshots manually on TrueNAS
- Create snapshots automatically on TrueNAS
- Clone snapshot on TrueNAS
- Rollback snapshot on TrueNAS
- Delete snapshot on TrueNAS
Create snapshots manually on TrueNAS
To create a snapshot manually on TrueNAS, use these steps:
-
Open TrueNAS (web).
-
Click on Storage from the left pane.
-
Click on Snapshots.
-
Click the Add button from the top-right corner.
-
Select the dataset from the “Dataset” setting.
-
(Optional) Confirm a descriptive name for the snapshot.
-
Check the Recursive option to include any child datasets in the snapshot.
-
Click the Submit button.
Once you complete the steps, TrueNAS will create the snapshot of your specified dataset.
Alternatively, you can create a snapshot manually from the “Pools” page by opening the dataset menu and choosing the “Create dataset” option.
Create snapshots automatically on TrueNAS
To schedule automatic snapshots on TrueNAS, use these steps:
-
Open TrueNAS (web).
-
Click on Tasks from the left pane.
-
Click on Periodic Snapshot Tasks.
-
Click the Add button from the top-right corner.
-
Select the dataset with the data in the “Dataset” setting.
-
Check the Recursive option.
-
Choose the retention time for the snapshot in the “Snapshot Lifetime” setting.
Quick note: Retaining snapshots for a long time can increase storage usage. This setting will depend on your needs, but usually, two weeks should be optimal for a small lab or office. -
(Optional) Specify a naming scheme for the snapshots.
Quick note: The default naming scheme is efficient for most use cases, but you can change it to anything you want as long as you know how to use STRFTIME (FreeBSDF format date and time) tool. -
Configure the frequency that TrueNAS should create snapshots automatically. Options available include “Daily,” “Weekly,” “Monthly,” and “Custom.”
Quick note: The default time is midnight, but you can change the hour to anything you want using the “Custom” option. -
Check the “Allow Taking Empty Snapshots” option.
-
Check the Enabled option.
-
Click the Submit button.
After you complete the steps, TrueNAS will create snapshots automatically in the intervals you specified in the settings. Also, each snapshot will be retained for the specified time.
The “Replication Tasks” is another feature that sends snapshots to a remote server with a ZFS storage configuration, such as another TrueNAS server, allowing you to have an offsite data backup.
Clone snapshot on TrueNAS
To clone a TrueNAS snapshot, use these steps:
-
Open TrueNAS (web).
-
Click on Storage from the left pane.
-
Click on Snapshots.
-
Select and expand the snapshot to clone.
-
Click the “Clone to new dataset” option.
-
Click the Submit button.
Once you complete the steps, the system will create a clone of the snapshot clone. You can then use the “Windows Shares (SMB)” feature to make the data accessible to recover files. After you complete the recovery, you can delete the dataset with the cloned data from the “Pools” settings page by opening the dataset menu and selecting the “Delete Dataset” option.
Rollback snapshot on TrueNAS
To rollback a snapshot on TrueNAS, use these steps:
-
Open TrueNAS (web).
-
Click on Storage from the left pane.
-
Click on Snapshots.
-
Select and expand the snapshot to clone.
-
Click the Rollback option.
-
Select the stop rollback option that best applies to your situation.
Quick note: It’s important to note that you need to be sure of what you’re doing when using this option because when rolling back a snapshot will also delete all other snapshots created after the snapshot you are trying to roll back. -
Check the Confirm button.
-
Click the Rollback button.
After you complete the steps, the snapshot will roll back on the server according to the safety check you have selected. Ideally, it’s not recommended to use this feature. Instead, you want to use the clone feature to recover any data.
Delete snapshot on TrueNAS
To delete a snapshot on TrueNAS, use these steps:
-
Open TrueNAS (web).
-
Click on Storage from the left pane.
-
Click on Snapshots.
-
Select and expand the snapshot to clone.
-
Click the Delete option.
-
Check the Confirm option.
-
Click the Delete button.
Once you complete the steps, TrueNAS will delete the snapshot from the system. You may need to repeat the steps to remove other snapshots from the server.
It’s important to note that snapshots are not replacements for backups. If the server encounters hardware failure or critical data corruption occurs on the drives, you may not be able to use snapshots to recover the data.