TL;DR
Starting with Solaris 11.4 SRU 90, you can override retention.policy and retention.period.grace when doing a zfs send/receive, allowing you to create a copy of a dataset with different (or no) retention settings. Previously this was blocked. Note that already retained files remain retained, and other retention parameters still cannot be overridden.
Changing the retention
A while ago, I wrote a series of articles on the topic of ZFS retention. I would like to add another article about a change in Solaris 11 SRU 90.
As covered in those older articles, you cannot make any changes to a file or delete it as soon as it has been retained by the policy configured by the dataset. However, sometimes it would be quite practical to have a version of the dataset without retention enabled. Imagine a situation where you have a filesystem with a very short grace period and a retention of 10 years. You want to convert for example all your retained png into avif files. However, the tool writes in the same dataset. So you may end up with a lot of retained avif files you can’t get rid of for the next 10 years.
I have two systems. testbed running SRU 90 (11.4.90.214.1) and nfsserver running SRU 88 (11.4.88.207.1).
As an example, I would like to use this dataset. The retention policy is set to mandatory.
root@testbed:~# zfs get retention.policy test/mandatoryretention
NAME PROPERTY VALUE SOURCE
test/mandatoryretention retention.policy mandatory -
root@testbed:~# zfs get retention.period test/mandatoryretention
NAME PROPERTY VALUE SOURCE
test/mandatoryretention retention.period.default none -
test/mandatoryretention retention.period.deletegrace none -
test/mandatoryretention retention.period.grace 10s -
test/mandatoryretention retention.period.max 10y -
test/mandatoryretention retention.period.min none -Pre-SRU 90
Until SRU 89, there was an obstacle. With a zfs send/receive, it was not possible to enable retention on the target independently from the source. I would like to show you this on nfsserver. It is currently running Solaris 11.4 SRU 88.
At first, I create a snapshot of the filesystem with retention enabled.
root@nfsserver:~# zfs snapshot test/mandatoryretention@20260301Now I’m executing a zfs send|receive with a different retention policy.
root@nfsserver:~# zfs send test/mandatoryretention@20260301 | zfs receive -o retention.policy=off test/noretention
Cannot receive: cannot override received retention.policyI cannot choose a different retention grace period as well. This would be the case even if the parameter was previously set to none.
root@nfsserver:~# zfs send test/mandatoryretention@20260301 | zfs receive -o retention.period.grace=1d test/noretention
Cannot receive: cannot override received retention.period.graceChanged behaviour introduced with SRU 90
SRU 90 allows me to change some of the retention settings. Let me demonstrate this on testbed, which is running this version of the operating system.
root@testbed:~# zfs send test/mandatoryretention@20260301 | zfs receive -o retention.policy=off test/noretention
root@testbed:~# zfs get retention.policy test/noretention
NAME PROPERTY VALUE SOURCE
test/noretention retention.policy off -It is also possible to change the retention grace period. Please note that you can set a larger grace period than the one on the source dataset. You can even disable the grace period by setting retention.period.grace to 0.
root@testbed:~# zfs send test/mandatoryretention@20260301 | zfs receive -o retention.policy=privileged -o retention.period.grace=1w test/noretention3
root@testbed:~# It is not possible to change other retention parameters.
root@testbed:~# zfs send test/mandatoryretention@20260301 | zfs receive -o retention.policy=privileged -o retention.period.grace=1d -o retention.period.default=1d test/noretention4
Cannot receive: cannot override received retention.period.defaultConclusion
Important to know:
- This is not a mechanism to change the retention settings of an already existing dataset.
- Files already retained in the source dataset will be retained in the new dataset. Everything retained stays retained.
The new feature in Solaris 11.4 SRU 90 allows you for example to switch off retention for new unretained files. Returning to our example: the new avif files wouldn’t be unnecessarily retained for 10 years right after creation before you can move them somewhere else.