Say 'Cheese': OpenSolaris' Time Slider
July 27, 2009
Whenever an operating system however obscure comes up with a killer feature, it's worth sitting up and taking notice. And there's no doubt that OpenSolaris' Time Slider feature is heavily armed and dangerous.
Introduced in November 2008 and updated in the most recent June 2009 OpenSolaris 2009.06 release, Time Slider is a graphical tool that provides a window into the operating system's powerful snapshot feature. This enables a user to move a file or directory back in time and watch how it changes. From there, it's a simple step to grab a version from out of the past and bring it back to the present. All with just a couple of mouse clicks.
To understand OpenSolaris' snapshot feature you must know a little bit about the operating system's underlying ZFS file system. Put simply, whenever a file is modified in ZFS, the original data is left unchanged, and the modified data is written to a new part of the storage pool. Since no data is actually deleted, the storage pool contains all the data needed to create snapshots of the file system, as it changes over time. Snapshots are taken automatically by the file system or can be taken manually. They are very quick to create because all the data required is already stored in various places in the storage pool. And since all snapshots (and the current files) share any common data, snapshots are space efficient, or, put another way, you can usually keep large numbers of snapshots without taking up too much storage space. The first screenshot below, for example, shows a system with 12 snapshots that take up a total of just 1.3MB of data.
This is in stark contrast with Apple's Time Machine, which stores large amounts of backed up data on a separate drive (which more or less rules out laptops) and which can take some considerable time to create snapshots.
What Time Slider brings to the party is a way of leveraging the power of ZFS snapshots to do something really useful: Recover files that have been accidentally deleted or overwritten, or roll back an entire system or part of a system to an earlier state. The key to Time Slider is that it is integrated into Nautilus, the Gnome desktop file manager, so finding previous versions of files is nearly as simple as finding current versions.
To start using Time Slider, all that's necessary is to enable it from the System - Administration menu and specify which file systems to snapshot automatically (at boot, every 15 minutes, every hour and every day by default.) It's possible to back up all file systems or user selected ones (e.g., the home directory only), and specify a limit to the proportion of storage space that snapshots consume.
To take a look at how Time Slider works, let's imagine I have a screenshot of my OpenSolaris desktop called "enable," stored in my home directory. At some point in the day I take another screenshot of a dialog box, which I accidentally save to my home directory with the same name ("enable"), overwriting the original screenshot in the process. Some time later I notice what has happened: The original screenshot has been overwritten with the newer one.
To retrieve the original file, the first step is to open a view of my home folder in Nautilus. This displays various files and folders, including the screenshot I am interested in, on the right. Above this you'll see the Time Slider "Restore" button, and the Time Slider itself, all the way over to the right, in the "Now" position. Nautilus is displaying the home folder "Now", in its current state.
To retrieve the overwritten file all that's needed is to move the Time Slider to the left to some point in time before the original screenshot was overwritten. The process is breathtakingly fast: Moving back in time to retrieve older versions of files takes just a fraction of a second.
Once the original version of the file is visible, it's an easy matter to restore it. This can be done by dragging or copying and pasting the file to another Nautilus window, or by right clicking on the file and choosing "Restore to Desktop."
OpenSolaris version 2009.06, which was released in early June, has added a few refinements to the original Time Slider feature.
One of these is the ability to right click on any file in Nautilus and select to view previous versions that are stored in snapshots. For example, by choosing View Previous Versions of the file "enable," it is possible to instantly see the previous version, which contains the screenshot to be restored.
Other features include the ability to take an instant manual snapshot of a directory from Nautilus by clicking on the camera icon beneath the Time Slider, and some architectural improvements that make it now possible to browse large numbers of snapshots without any appreciable slowdown in performance, according to Sun.
Killer features in any operating system tend to make their way over to other operating systems sooner or later, but since Time Slider is dependent on ZFS it won't appear beyond OpenSolaris or other ZFS-based OSes.
The good news is that ZFS is slated to be introduced (in full read and write mode) on Apple OS X servers in the near future, and it could also conceivably appear on Linux at some point as well. Thus, even if you're not an OpenSolaris user, recovering from accidentally overwriting vital config files or unsuccessful application upgrades may one day be as simple as dragging a slider a few inches to the right, clicking restore and waiting a couple of seconds.