Creating a ZFS File System With File Retention

You must enable file retention on a ZFS file system when you create it. By default, file retention is disabled on ZFS file systems.

During the ZFS file system creation process, you must specify the file retention policy:

zfs create -o retention.policy=policy pool/fs

Specify one of the following policies as the retention.policy property value:

  • privileged - Permits a process with the FILE_RETENTION_OVERRIDE privilege to override retention protections and delete files. Note that this privilege does not permit you to modify retained files.

    You can destroy the file system and pool without requiring additional privileges if the contained file systems use the privileged retention policy or have file retention disabled.

  • mandatory - Prevents you from deleting a retained file until the retention period ends.

    The mandatory policy's protection extends to the file system and pool. As a result, the file system and pool cannot be destroyed until the retention period of all files in the file system and pool have expired. A file system that uses the mandatory retention policy also protects its ancestors and clone descendants from being destroyed.

Note that after you set the retention.policy property on the ZFS file system, you cannot change the policy value or disable the file retention feature.

A retained file system preserves the full path name of each retained file, which ensures that you cannot hide a directory's location and cannot change any meaning that is conveyed by the retained file's path.