The latest ZFSSA software release (as of this post) is OS8.8.39.
This release contains the ability to make both scheduled snapshots and manual snapshots immutable, and I will go through how this works in this post.
New Authorizations
There are 3 new authorizations added to support Snapshot immutability. The authorizations are
- releaseSnapRetention - This allows the role to release a snapshot from it's retention hold
- scheduleLockedSnap - This allows the role to schedule a locked snapshot
- retainSnap - This allows the role to create a manual locked snapshot
In order to show how this works I created a new role "Security_Admin" and granted this role the new authorizations.
You can see that the "Security_Admin" role has releaseSnapRetention, scheduleLockedSnap and retainSnap authorizations which reside under the "Projects and shares" scope.
Create a Manual Locked Snapshot (BUI)
- Off - There is no retention on this snapshot (normal)
- Unlocked - There is a locked retention on this snapshot
Change the retention setting of a Snapshot (BUI)
Create a Manual Locked Snapshot (CLI)
zfssim:shares NFSbackups> select NFS_immutable
zfssim:shares NFSbackups/NFS_immutable>
zfssim:shares NFSbackups> snapshots
zfssim:shares NFSbackups/NFS_immutable snapshots>
zfssim:shares NFSbackups/NFS_immutable snapshots> snapshot -r Save_until_Jan_1_2022
zfssim:shares NFSbackups/NFS_immutable snapshots>
zfssim:shares objectstore> select rmanbackups
zfssim:shares objectstore/rmanbackups>
zfssim:shares NFSbackups/NFS_immutable@Save_until_Jan_1_2022> show
Properties:
creation = Tue Nov 16 2021 20:35:25 GMT+0000 (UTC)
numclones = 0
isauto = false
retentionpolicy = unlocked
pool = generalpool1
canonical_name = generalpool1/local/NFSbackups/NFS_immutable@Save_until_Jan_1_2022
shadowsnap = false
space_unique = 0
space_data = 31K
Change the retention setting of a Snapshot (CLI)
zfssim:shares NFSbackups/NFS_immutable@Save_until_Jan_1_2022> get retentionpolicy
retentionpolicy = unlocked
zfssim:shares NFSbackups/NFS_immutable@Save_until_Jan_1_2022> set retentionpolicy=off
retentionpolicy = off (uncommitted)
zfssim:shares NFSbackups/NFS_immutable@Save_until_Jan_1_2022> get retentionpolicy
retentionpolicy = off (uncommitted)
zfssim:shares NFSbackups/NFS_immutable@Save_until_Jan_1_2022> commit
zfssim:shares NFSbackups/NFS_immutable@Save_until_Jan_1_2022> show
Properties:
creation = Tue Nov 16 2021 20:35:25 GMT+0000 (UTC)
numclones = 0
isauto = false
retentionpolicy = off
pool = generalpool1
canonical_name = generalpool1/local/NFSbackups/NFS_immutable@Save_until_Jan_1_2022
shadowsnap = false
space_unique = 0
space_data = 31K
Children:
backups => Configure Cloud Backups
targets => List snapshot parents per target
zfssim:shares NFSbackups/NFS_immutable@Save_until_Jan_1_2022>
Deleting a Manual Locked Snapshot
zfssim:shares NFSbackups/NFS_immutable@Save_until_Jan_1_2022> destroy
This will destroy all data in "Save_until_Jan_1_2022"! Are you sure? (Y/N) y
error: The action could not be completed because the target 'NFSbackups/NFS_immutable@Save_until_Jan_1_2022' is in use. It cannot be modified while it, or its children, are actively changing. Make sure no other users are editing the
share configuration and try again. If this problem persists, contact your service provider.
Enable Scheduled Locked Snapshots (BUI)
The next step is to enable scheduled locked snapshots. You will notice (highlighted below) that there is a new option to enable the retention policy for locked scheduled snapshots under the project and share.
shares --> share/project --> snapshots
Create Scheduled Locked Snapshots (BUI)
Viewing retention status of scheduled snapshots (BUI)
Deleting locked scheduled snapshots (BUI) - Not allowed
Enable Scheduled Locked Snapshots (CLI)
zfssim:shares NFSbackups/nfstest> get snapret_enabled
snapret_enabled = false (inherited)
zfssim:shares NFSbackups/nfstest> set snapret_enabled=true
snapret_enabled = true (uncommitted)
zfssim:shares NFSbackups/nfstest> commit
zfssim:shares NFSbackups/nfstest> get snapret_enabled
snapret_enabled = true
zfssim:shares NFSbackups/nfstest>
Create Schedule Locked Snapshots (CLI)
zfssim:shares NFSbackups/nfstest>
zfssim:shares NFSbackups/nfstest> snapshots
zfssim:shares NFSbackups/nfstest snapshots> automatic
zfssim:shares NFSbackups/nfstest snapshots automatic> create
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)> show
Properties:
frequency = (unset)
day = (unset)
hour = (unset)
minute = (unset)
keep = 0
retentionhold = 0
retentionpolicy = off
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)> set frequency=day
frequency = day (uncommitted)
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)> set hour=06
hour = 06 (uncommitted)
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)> set minute=00
minute = 00 (uncommitted)
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)> set keep=35
keep = 35 (uncommitted)
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)> set retentionhold=30
retentionhold = 30 (uncommitted)
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)> set retentionpolicy=locked
retentionpolicy = locked (uncommitted)
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)> show
Properties:
frequency = day (uncommitted)
day = (unset)
hour = 06 (uncommitted)
minute = 00 (uncommitted)
keep = 35 (uncommitted)
retentionhold = 30 (uncommitted)
retentionpolicy = locked (uncommitted)
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)>
zfssim:shares NFSbackups/nfstest snapshots automatic-000 (uncommitted)> commit
zfssim:shares NFSbackups/nfstest snapshots automatic> show
Properties:
convert = false
Automatics:
NAME FREQUENCY DAY HH:MM KEEP
automatic-000 day - 06:00 35
Viewing retention status of scheduled snapshots (CLI)
zfssim:shares NFSbackups/zfsshare> snapshots
zfssim:shares NFSbackups/zfsshare snapshots> list
.auto-Bihourly_snapshots-20211116T193000UTC
.auto-Bihourly_snapshots-20211116T200000UTC
.auto-Bihourly_snapshots-20211116T203000UTC
.auto-Bihourly_snapshots-20211116T210000UTC
.auto-Bihourly_snapshots-20211116T213000UTC
zfssim:shares NFSbackups/zfsshare snapshots> select .auto-Bihourly_snapshots-20211116T203000UTC
zfssim:shares NFSbackups/zfsshare@.auto-Bihourly_snapshots-20211116T203000UTC> show
Properties:
creation = Tue Nov 16 2021 20:30:00 GMT+0000 (UTC)
numclones = 0
isauto = true
retentionpolicy = locked
pool = generalpool1
canonical_name = generalpool1/local/NFSbackups/zfsshare@.auto-Bihourly_snapshots-20211116T203000UTC
shadowsnap = false
space_unique = 0
space_data = 1.22G
Children:
backups => Configure Cloud Backups
targets => List snapshot parents per target
zfssim:shares NFSbackups/zfsshare@.auto-Bihourly_snapshots-20211116T203000UTC>