atom5ive
Dabbler
- Joined
- Sep 11, 2023
- Messages
- 17
Hello TrueNAS SCALE Community!
I recently wanted to set up periodic snapshots for my VMs in TrueNAS SCALE, and I found that there isn't a straightforward GUI option to do this. Instead, I had to use the command line interface (CLI) to achieve my goal. I wanted to share the steps I followed, and if you have any alternative methods or suggestions, please feel free to chime in!
Here are the steps to set up periodic snapshots for your VMs using the CLI:
Step 1: SSH into your TrueNAS system and access the CLI.
Step 2: Get the name of the dataset you want to configure. You can get the list of datasets with:
shell
zfs list
Step 3: Set the snapdir property on the dataset. For example:
shell
zfs set snapdir=/mnt/pool1/snapshots dataset1
Step 4: Verify the snapshot directory is set:
shell
zfs get snapdir dataset1
Step 5: Take a snapshot to test it:
shell
zfs snapshot dataset1@testsnap
Step 6: List snapshots and check the location:
shell
zfs list -t snapshot
The snapshot should now be stored in the defined /mnt/pool1/snapshots path.
If you run into any issues setting the custom snapshot directory this way through the CLI, please let me know. The key is using zfs set snapdir= to define the path you want to use for a given dataset.
However, I also discovered that the ability to set a custom snapshot directory per dataset is not exposed in the TrueNAS SCALE UI. The "snapshot directory" and "snapdev" options you see control the visibility of the .zfs snapshot directory but don't allow setting a custom path.
Here are some alternative options:
Is all the above information accurate? Please tell me there's an easier way via the GUI to simply define the location of where you want your snapshots to be stored. That's' it. Nothing to crazy.
I recently wanted to set up periodic snapshots for my VMs in TrueNAS SCALE, and I found that there isn't a straightforward GUI option to do this. Instead, I had to use the command line interface (CLI) to achieve my goal. I wanted to share the steps I followed, and if you have any alternative methods or suggestions, please feel free to chime in!
Here are the steps to set up periodic snapshots for your VMs using the CLI:
Step 1: SSH into your TrueNAS system and access the CLI.
Step 2: Get the name of the dataset you want to configure. You can get the list of datasets with:
shell
zfs list
Step 3: Set the snapdir property on the dataset. For example:
shell
zfs set snapdir=/mnt/pool1/snapshots dataset1
Step 4: Verify the snapshot directory is set:
shell
zfs get snapdir dataset1
Step 5: Take a snapshot to test it:
shell
zfs snapshot dataset1@testsnap
Step 6: List snapshots and check the location:
shell
zfs list -t snapshot
The snapshot should now be stored in the defined /mnt/pool1/snapshots path.
If you run into any issues setting the custom snapshot directory this way through the CLI, please let me know. The key is using zfs set snapdir= to define the path you want to use for a given dataset.
However, I also discovered that the ability to set a custom snapshot directory per dataset is not exposed in the TrueNAS SCALE UI. The "snapshot directory" and "snapdev" options you see control the visibility of the .zfs snapshot directory but don't allow setting a custom path.
Here are some alternative options:
- Set the "Snapshot Directory" on the pool level: You can define the default location for all datasets on that pool by navigating to Storage > Pools > EDIT OPTIONS.
- Use the CLI: You can set the "snapdir" property on datasets to the desired path, as mentioned above.
- Set the snapshot path in each Periodic Snapshot Task definition: This allows you to define the snapshot location in the task itself.
Is all the above information accurate? Please tell me there's an easier way via the GUI to simply define the location of where you want your snapshots to be stored. That's' it. Nothing to crazy.