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:
-
rtimeproperty - Specify the date and time at which you want the retention period to end in one of the following ways:-
touch -Rfilename - Changes the retention period of the specified file to the current date and time plus the default retention period.If you use the
touch -Rcommand to specify a date and time, the specified value becomes the end of the retention period.You can use the
touch -Rcommand to extend the retention period of a retained file by specifying a date and time in the future. You can also use thetouch -tandtouch -fcommands 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
touchcommand. These commands enable you to set theatimeproperty value to a future date and time before you make the file read-only:-
touch -RMMDDhhmm[YY]filename -
touch -aMMDDhhmm[YY]filename
Note:
If you do not specify anatimeproperty value, the file's retention period is specified by theretention.period.defaultproperty value. -
-
chmod a-wfilename orchmod ugo-wfilename - 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
atimeis set to a future date and time. In that case, these commands use theatimevalue.Use these commands only when the ZFS file system is local or NFS mounted.
-
chmod S+cRfilename orchmod S+vreadonlyfilename - Sets thereadonlyfile attribute on the file over SMB, which triggers file retention.These commands use the current date and time plus the default retention period unless
atimeis set to a future date and time. In that case, these commands use theatimevalue.When a file's retention period ends, the
readonlyattribute is removed. At that time, you can retain the file again by specifying a new retention period.
-
-
minandmaxZFS properties - Specifies the minimum and maximum values that limit the retention period.If you do not specify a time with the
touchcommand, remove write permissions, or set thereadonlyattribute on the file, files are retained for the default retention period.The
retention.period.minandretention.period.maxproperty values serve as limits on both the default retention period and for how long you can usetouch -Rto 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 theminandmaxproperty values. So, if a retention period that exceeds the range, the period is limited by theminandmaxproperty values.The
atimethat you set on a file by usingtouch -acommand adheres to the time range restrictions only if its retainedatimevalue is set tooff. For example:# zfs set atime=off filesystemOptionally, using the
minandmaxmethod automatically retains files that have remained unmodified for the default retention period.You can use the
touch -aandtouch -Rcommands to retain a file in a retained ZFS file system. When run on file systems that have file retention disabled,touch -asets theatimeproperty value andtouch -Rgenerates an error.