DBA > Articles

Automating ZFS Snapshots and Tracking Software Updates

By: Ginny Henningsen
To read more DBA articles, visit http://dba.fyicenter.com/article/

This is the second article in a series highlighting best practices in Oracle Solaris 11 Express. The first article, Updating Software, introduced the Image Packaging System (IPS) software packaging model and discussed the best practice for performing updates: creating a new Boot Environment (BE) before applying an update. In some cases, such as with updates and full upgrades, IPS creates a new BE automatically.

BEs are a built-in safety net when you make software changes, much like Live Upgrade environments in Oracle Solaris 10. In Oracle Solaris 11 Express, the root file system is implemented using Oracle Solaris ZFS, so BEs are basically Oracle Solaris ZFS snapshots that are readable/writableand activated for booting. Because of this underlying technology, you can periodically generate snapshots of BEs just like you can take a snapshot of any Oracle Solaris ZFS volume.

This article describes how Oracle Solaris 11 Express uses automated snapshots to deliver Time Slider services, a new feature in the GNOME desktop. Using Time Slider, you can take periodic snapshots of the active BE, capturing the software state at regular intervals. This approach might prove useful if you forget to explicitly create a BE when you update software.

Since the history of software updates can be especially helpful in troubleshooting, this article also highlights commands for researching package changes. Note that all examples presume an authorized user (see “User Accounts, Roles, and Rights Profiles” in Getting Started With Oracle Solaris 11 Express).

Introducing Time Slider
The Time Slider service is a new component in the GNOME file manager (a.k.a., nautilus), and it relies on services that generate periodic Oracle Solaris ZFS snapshots. Similar in concept to Time Machine in Apple’s Mac OS, Time Slider provides an easy way for desktop users to restore individual files or directories from automatically scheduled, incremental snapshots of home directories. Once activated and set up, Time Slider services can generate “frequent” snapshots (every 15 minutes, by default), as well as hourly, daily, weekly, or monthly.

The services that automate periodic snapshots can do so for any file system, as well as BEs, even on non-desktop systems. However, to automatically snapshot using Time Slider mechanisms, packages for the GNOME desktop environment (for example, the slim_install package group) are required even when the gdm desktop manager is not running. (This is because Time Slider services use notification mechanisms that are part of the GNOME stack.)

How Do I Enable Time Slider Services Using the Command Line?
First, if you are not using the GUI, designate the file systems and BEs to be captured via automatic snapshots. To do this, set the com.sun:auto-snapshot property to true, as shown in the following commands. The first command designates the home directory of user jdoe, and the second command designates the home directory of user rkai. In the output of the third command, values shown as true will be snapshotted.

# zfs set com.sun:auto-snapshot=true rpool1/export/home/jdoe
# zfs set com.sun:auto-snapshot=true rpool1/export/home/rkai
# zfs get all |grep auto-snapshot

Since directories inherit Oracle Solaris ZFS properties from their parent, setting up automatic snapshots for /export/home captures all subdirectories in that hierarchy.

Whether or not you use the GUI to select what to snapshot, you must first enable Time Slider services. In the following example, all auto-snapshot services are enabled, as are the Time Slider plug-in and Time Slider services, which are also needed:
# svcadm enable auto-snapshot:frequent
# svcadm enable auto-snapshot:hourly
# svcadm enable auto-snapshot:daily
# svcadm enable auto-snapshot:weekly
# svcadm enable auto-snapshot:monthly
# svcadm enable time-slider/plugin:zfs-send
# svcadm enable time-slider/plugin:rsync
# svcadm enable time-slider

Since auto-snapshot and time-slider/plugin services depend on the time-slider service, be sure to enable the time-slider service last (or restart it). Again, these services require GNOME desktop packages, and they go into maintenance mode if they are enabled when GNOME packages are not installed.

On a Desktop, How Do I Use Time Slider?
Once services are activated and Oracle Solaris ZFS properties are set (either through the GUI or command line, as described above), Time Slider functionality is available within the GNOME file manager. Start the file manager and click the clock icon in the file manager’s navigation bar. (If the clock icon is grayed out, Time Slider services haven’t been enabled properly. Go back and check the previous steps and then restart the file manager.)

Time Slider functionality allows the desktop user to navigate among captured snapshots. In Figure 2, the left-most file manager shows home directory contents of an earlier snapshot while the right-most file manager shows the current state. A directory called “Project A” appears in the earlier snapshot but no longer exists in the current directory.

Full article...

Other Related Articles

... to read more DBA articles, visit http://dba.fyicenter.com/article/