6 minute read.Last Modified 2022-04-07 16:08 EDT
Snapshots are one of the most powerful features of ZFS. A snapshot provides a read only point-in-time copy of a file system or volume. This copy does not consume extra space in the ZFS pool. The snapshot only records the differences between storage block references whenever the data is modified.
Consider making a Periodic Snapshot Task to save time and create regular, fresh snapshots.
This short video demonstrates manually adding a snapshot
Go to Storage and click Snapshots, then click ADD.
Use the Dataset drop-down to select an existing ZFS pool, dataset, or zvol to snapshot.
TrueNAS software generates a suggested name that you can override with any custom string.
TrueNAS software populates the Naming Schema drop-down with periodic snapshot task schemas already created. Choosing one generates a name for the snapshot using the naming schema from the selected Periodic Snapshot and replicates that snapshot. You cannot enter a value in Naming Schema and Name as selecting or entering a value in Naming Schema populates the other.
To include child datasets with the snapshot, set Recursive.
Go to Storage and click Snapshots to manage created snapshots.
Each entry in the list includes the dataset and snapshot names. Entries also display the snapshot numbers, the space they use, the date the system created them, and the amount of data the dataset can access.
Click more_vert to view snapshot options.
The Delete option destroys the snapshot. You must delete child clones before you can delete their parent snapshot. While creating a snapshot is instantaneous, deleting one is I/O intensive and can take a long time, especially when deduplication is enabled.
The Clone to New Dataset option creates a new snapshot clone (dataset) from the snapshot contents.
A dialog prompts for the new dataset name. The suggested name derives from the snapshot name.
The Rollback option reverts the dataset back to the point in time saved by the snapshot.
Rollback is a dangerous operation that causes any configured replication tasks to fail. Replications use the existing snapshot when doing an incremental backup, and rolling back can put the snapshots ‘out of order’. To restore the data within a snapshot, the recommended steps are:
- Clone the desired snapshot.
- Share the clone with the share type or service running on the TrueNAS system.
- Allow users to recover their needed data.
- Delete the clone from Storage.
This approach does not destroy any on-disk data or impact replication.
TrueNAS asks for confirmation before rolling back to the chosen snapshot state. Clicking Yes reverts all dataset files to the state they were in when TrueNAS created the snapshot.
To delete multiple snapshots, select the left column box for each snapshot to include. Click the delete Delete button that displays.
To search through the snapshots list by name, type a matching criteria into the search Filter Snapshots text field. The list now displays only the snapshot names that match the filter text.
Browsing a snapshot collection is an advanced capability that requires ZFS and command-line experience.
All dataset snapshots are accessible as an ordinary hierarchical file system, accessed from a hidden
A snapshot and any files it contains are not accessible or searchable if the snapshot mount path is longer than 88 characters. The data within the snapshot is safe but to make the snapshot accessible again shorten the mount path.
A user with permission to access the hidden file can view and explore all snapshots for a dataset from the Shell or the Shares screen using services like SMB, NFS, and SFTP.
In summary, the main required changes to settings are:
- In dataset properties, change the ZFS properties to enable snapshot visibility.
- In the Samba auxiliary settings, change the
veto filescommand to not hide the
.zfs, and add the setting
The effect is that any user who can access the dataset contents can view the list of snapshots by going to the dataset
When creating a snapshot, permissions or ACLs set on files within that snapshot mmight limit access to the files.
Snapshots are read-only, so users do not have permission to modify a snapshot or its files, even if they had write permissions when creating the snapshot.
zfs diff ZFS command, which can run in the Shell, lists all changed files between any two snapshot versions within a dataset, or between any snapshot and the current data.
VMware-Snapshots coordinate ZFS snapshots when using TrueNAS as a VMware datastore. When TrueNAS creates a ZFS snapshot, it snapshots any running VMware virtual machines before it takes a scheduled or manual ZFS snapshot of the dataset or zvol backing that VMware datastore.
You must power on virtual machines for TrueNAS to copy snapshots to VMware. The temporary VMware snapshots deleted on the VMware side, still exist in the ZFS snapshot and are available as stable restore points. These coordinated snapshots go in the Snapshots list.
Only paid versions of VMware ESXi support VMware-Snapshots. Attempting to create VMware-Snapshots with ESXi free results in the following error message: “Error: Can’t create snapshot, current license or ESXi version prohibits execution of the requested operation.”. ESXi free has a locked (read only) API that prohibits using TrueNAS VMware-Snapshots. VMware vSphere Essentials Kit is the cheapest ESXi edition that is compatible with TrueNAS VMware-Snapshots.
Go to Storage and click VMware Snapshots, then click ADD.
|Hostname||Enter the IP address or hostname of the VMware host. When clustering, this is the vCenter server for the cluster.|
|Username||Enter the user on the VMware host with permission to snapshot virtual machines.|
|Password||Enter the password associated with the user entered in Username.|
|ZFS Filesystem||Select a file system to snapshot.|
|Datastore||After entering the values in Hostname, *Username, and Password, click Fetch DataStores and select the datastore to synchronize.|
TrueNAS connects to the VMware host after clicking Fetch DataStores. The ZFS Filesystem and Datastore drop-down menus populate from the VMware host response. Choosing a datastore also selects any previously mapped dataset.