Retaining Your Files
You cannot remove a retained file until its retention period expires. You can use the default retention period or specify your own retention period a the time that you retain a file.
Use one of the following methods to specify the retention period for a file:
-
rtime
property - Specify the date and time at which you want the retention period to end in one of the following ways:-
touch -R
filename - Changes the retention period of the specified file to the current date and time plus the default retention period.If you use the
touch -R
command to specify a date and time, the specified value becomes the end of the retention period.You can use the
touch -R
command to extend the retention period of a retained file by specifying a date and time in the future. You can also use thetouch -t
andtouch -f
commands to specify a future date and time. Note that you cannot shorten the retention period of a retained file.Use this command only when the ZFS file system is local to the Oracle Solaris system.
You can specify the retention period for a file by using the
touch
command. These commands enable you to set theatime
property value to a future date and time before you make the file read-only:-
touch -R
MMDDhhmm[
YY]
filename -
touch -a
MMDDhhmm[
YY]
filename
Note:
If you do not specify anatime
property value, the file's retention period is specified by theretention.period.default
property value. -
-
chmod a-w
filename orchmod ugo-w
filename - Removes all write permissions from the file, which triggers file retention.These commands use the current date and time plus the default retention period unless
atime
is set to a future date and time. In that case, these commands use theatime
value.Use these commands only when the ZFS file system is local or NFS mounted.
-
chmod S+cR
filename orchmod S+vreadonly
filename - Sets thereadonly
file attribute on the file over SMB, which triggers file retention.These commands use the current date and time plus the default retention period unless
atime
is set to a future date and time. In that case, these commands use theatime
value.When a file's retention period ends, the
readonly
attribute is removed. At that time, you can retain the file again by specifying a new retention period.
-
-
min
andmax
ZFS properties - Specifies the minimum and maximum values that limit the retention period.If you do not specify a time with the
touch
command, remove write permissions, or set thereadonly
attribute on the file, files are retained for the default retention period.The
retention.period.min
andretention.period.max
property values serve as limits on both the default retention period and for how long you can usetouch -R
to retain a file.Alternately, you can use the access time (
atime
) as the retention period. When you retain a file, its retention period is restricted to a range between themin
andmax
property values. So, if a retention period that exceeds the range, the period is limited by themin
andmax
property values.The
atime
that you set on a file by usingtouch -a
command adheres to the time range restrictions only if its retainedatime
value is set tooff
. For example:# zfs set atime=off filesystem
Optionally, using the
min
andmax
method automatically retains files that have remained unmodified for the default retention period.You can use the
touch -a
andtouch -R
commands to retain a file in a retained ZFS file system. When run on file systems that have file retention disabled,touch -a
sets theatime
property value andtouch -R
generates an error.