h2. How to Manage the Automatic ZFS Snapshot Service
The Time Slider automatic snapshot tool automatically takes snapshots of ZFS file systems and enables you to browse and recover snapshots of file systems.
This tool provides the following features:
* SMF snapshot service instances schedule recurring snapshots.
* Automatic snapshots are scheduled from the zfssnap crontab.
* Older snapshots are removed based on a predefined percentage of file system space used.
* Browse and recover files from snapshots by using the GNOME file manager.
When the Time Slider tool is enabled, ZFS file system snapshots are created based on the following criteria:
{code}
frequent snapshots every 15 mins, keeping 4 snapshots
hourly snapshots every hour, keeping 24 snapshots
daily snapshots every day, keeping 31 snapshots
weekly snapshots every week, keeping 4 snapshots
monthly snapshots every month, keeping 12 snapshots
{code}
h5. Before You Begin
Use the steps below to add yourself to the zfssnap role if you want to modify the Time Slider behavior with the GNOME file manager.
* From the System menu, choose Administration
* Then, select the Users and Groups tool
* Select your user account and select the properties menu
* Select the User roles tab and select the zfssnap role
* Click the OK button
* From the Users and Group screen, click the OK button
* Confirm that you are added to the zfssnap role from a terminal window:
$ *roles*
root,zfssnap
h5. Steps
# {include:root_step}
# *Enable the Time Slider service, which is disabled by default.*
You can enable or disable these services from the command line or from the System → Administration → Time Slider menu. From this menu, you can also customize which ZFS file systems to snapshot and adjust the file system capacity setting for when snapshots are removed.
# *Review the default automatic snapshot service instances that are started when the Time Slider service is enabled.*
{code}
# svcs | grep auto-snapshot
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:frequent
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:hourly
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:weekly
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:monthly
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:daily
{code}
# *Confirm that automatic snapshots are created.*
For example:
{code}
# zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
rpool@zfs-auto-snap:monthly-2009-05-12-15:46 0 - 78.5K -
rpool@zfs-auto-snap:weekly-2009-05-12-15:46 0 - 78.5K -
rpool@zfs-auto-snap:daily-2009-05-12-15:46 0 - 78.5K -
rpool@zfs-auto-snap:hourly-2009-05-13-14:00 18K - 78.5K -
rpool@zfs-auto-snap:frequent-2009-05-13-14:45 18K - 78.5K -
rpool@zfs-auto-snap:hourly-2009-05-13-15:01 0 - 78.5K -
rpool@zfs-auto-snap:frequent-2009-05-13-15:15 0 - 78.5K -
rpool@zfs-auto-snap:frequent-2009-05-13-15:30 0 - 78.5K -
.
.
.
{code}
# *Disable or enable specific automatic snapshot services for the top-level dataset and all descendant datasets from the command line.*
For example:
{code}
# zfs set com.sun:auto-snapshot=false rpool
# zfs set com.sun:auto-snapshot=true rpool/ROOT/opensolaris
{code}
# *Choose to only take snapshots under a given schedule for a dataset and all direct descendant datasets from the command line.*
For example:
{code}
# zfs set com.sun:auto-snapshot=false rpool/export
# zfs set com.sun:auto-snapshot:weekly=true rpool/export
{code}
# *Change the frequency of a given snapshot schedule from the command line.*
For example:
{code}
# svccfg -s svc:/system/filesystem/zfs/auto-snapshot:frequent setprop zfs/period = 30
# svccfg -s svc:/system/filesystem/zfs/auto-snapshot:frequent refresh
# svcadm restart svc:/system/filesystem/zfs/auto-snapshot:frequent
{code}
# *Disable automatic snapshot services for the swap and dump volumes, from the command line, if necessary.*
For example:
{code}
# zfs set com.sun:auto-snapshot=false rpool/dump
# zfs set com.sun:auto-snapshot=false rpool/swap
{code}
# *Remove a range of unwanted snapshots, from the command line, if necessary.*
In the following example, all automatic snapshots in the bash shell are removed.
{code}
for s in $(zfs list -H -o name -t snapshot | grep @zfs-auto-snap);
do zfs destroy $s; done
{code}
In the OpenSolaris 2009.06 release, you can remove automatic ZFS snapshots from the Time Slider tool.
{include:bottom_navigation}
The Time Slider automatic snapshot tool automatically takes snapshots of ZFS file systems and enables you to browse and recover snapshots of file systems.
This tool provides the following features:
* SMF snapshot service instances schedule recurring snapshots.
* Automatic snapshots are scheduled from the zfssnap crontab.
* Older snapshots are removed based on a predefined percentage of file system space used.
* Browse and recover files from snapshots by using the GNOME file manager.
When the Time Slider tool is enabled, ZFS file system snapshots are created based on the following criteria:
{code}
frequent snapshots every 15 mins, keeping 4 snapshots
hourly snapshots every hour, keeping 24 snapshots
daily snapshots every day, keeping 31 snapshots
weekly snapshots every week, keeping 4 snapshots
monthly snapshots every month, keeping 12 snapshots
{code}
h5. Before You Begin
Use the steps below to add yourself to the zfssnap role if you want to modify the Time Slider behavior with the GNOME file manager.
* From the System menu, choose Administration
* Then, select the Users and Groups tool
* Select your user account and select the properties menu
* Select the User roles tab and select the zfssnap role
* Click the OK button
* From the Users and Group screen, click the OK button
* Confirm that you are added to the zfssnap role from a terminal window:
$ *roles*
root,zfssnap
h5. Steps
# {include:root_step}
# *Enable the Time Slider service, which is disabled by default.*
You can enable or disable these services from the command line or from the System → Administration → Time Slider menu. From this menu, you can also customize which ZFS file systems to snapshot and adjust the file system capacity setting for when snapshots are removed.
# *Review the default automatic snapshot service instances that are started when the Time Slider service is enabled.*
{code}
# svcs | grep auto-snapshot
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:frequent
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:hourly
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:weekly
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:monthly
online Oct_22 svc:/system/filesystem/zfs/auto-snapshot:daily
{code}
# *Confirm that automatic snapshots are created.*
For example:
{code}
# zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
rpool@zfs-auto-snap:monthly-2009-05-12-15:46 0 - 78.5K -
rpool@zfs-auto-snap:weekly-2009-05-12-15:46 0 - 78.5K -
rpool@zfs-auto-snap:daily-2009-05-12-15:46 0 - 78.5K -
rpool@zfs-auto-snap:hourly-2009-05-13-14:00 18K - 78.5K -
rpool@zfs-auto-snap:frequent-2009-05-13-14:45 18K - 78.5K -
rpool@zfs-auto-snap:hourly-2009-05-13-15:01 0 - 78.5K -
rpool@zfs-auto-snap:frequent-2009-05-13-15:15 0 - 78.5K -
rpool@zfs-auto-snap:frequent-2009-05-13-15:30 0 - 78.5K -
.
.
.
{code}
# *Disable or enable specific automatic snapshot services for the top-level dataset and all descendant datasets from the command line.*
For example:
{code}
# zfs set com.sun:auto-snapshot=false rpool
# zfs set com.sun:auto-snapshot=true rpool/ROOT/opensolaris
{code}
# *Choose to only take snapshots under a given schedule for a dataset and all direct descendant datasets from the command line.*
For example:
{code}
# zfs set com.sun:auto-snapshot=false rpool/export
# zfs set com.sun:auto-snapshot:weekly=true rpool/export
{code}
# *Change the frequency of a given snapshot schedule from the command line.*
For example:
{code}
# svccfg -s svc:/system/filesystem/zfs/auto-snapshot:frequent setprop zfs/period = 30
# svccfg -s svc:/system/filesystem/zfs/auto-snapshot:frequent refresh
# svcadm restart svc:/system/filesystem/zfs/auto-snapshot:frequent
{code}
# *Disable automatic snapshot services for the swap and dump volumes, from the command line, if necessary.*
For example:
{code}
# zfs set com.sun:auto-snapshot=false rpool/dump
# zfs set com.sun:auto-snapshot=false rpool/swap
{code}
# *Remove a range of unwanted snapshots, from the command line, if necessary.*
In the following example, all automatic snapshots in the bash shell are removed.
{code}
for s in $(zfs list -H -o name -t snapshot | grep @zfs-auto-snap);
do zfs destroy $s; done
{code}
In the OpenSolaris 2009.06 release, you can remove automatic ZFS snapshots from the Time Slider tool.
{include:bottom_navigation}