How to create, clone, rollback, delete snapshots on TrueNAS

Here are the steps to create and manage snapshots manually and automatically on TrueNAS.

TrueNAS snapshots

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

To create a snapshot manually on TrueNAS, use these steps:

  1. Open TrueNAS (web).

  2. Click on Storage from the left pane.

  3. Click on Snapshots.

  4. Click the Add button from the top-right corner.

    TrueNAS Snapshots settings

  5. Select the dataset from the “Dataset” setting.

    TrueNAS create snapshot manually

  6. (Optional) Confirm a descriptive name for the snapshot.

  7. Check the Recursive option to include any child datasets in the snapshot.

  8. 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:

  1. Open TrueNAS (web).

  2. Click on Tasks from the left pane.

  3. Click on Periodic Snapshot Tasks.

  4. Click the Add button from the top-right corner.

    TrueNAS periodic snapshot tasks

  5. Select the dataset with the data in the “Dataset” setting.

  6. Check the Recursive option.

  7. Choose the retention time for the snapshot in the “Snapshot Lifetime” setting.

    TrueNAS create snapshots automatically

    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.
  8. (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.
  9. 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.
  10. Check the “Allow Taking Empty Snapshots” option.

  11. Check the Enabled option.

  12. 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:

  1. Open TrueNAS (web).

  2. Click on Storage from the left pane.

  3. Click on Snapshots.

  4. Select and expand the snapshot to clone.

    TrueNAS clone snapshot settings

  5. Click the “Clone to new dataset” option.

  6. Click the Submit button.

    Clone new dataset

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:

  1. Open TrueNAS (web).

  2. Click on Storage from the left pane.

  3. Click on Snapshots.

  4. Select and expand the snapshot to clone.

  5. Click the Rollback option.

    TrueNAS rollback snapshot

  6. 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.
  7. Check the Confirm button.

    TrueNAS dataset rollback from snapshot settings

  8. 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:

  1. Open TrueNAS (web).

  2. Click on Storage from the left pane.

  3. Click on Snapshots.

  4. Select and expand the snapshot to clone.

  5. Click the Delete option.

    TrueNAS delete snapshot

  6. Check the Confirm option.

  7. 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.