Tuesday May 23, 2006

I spent a bit of a time few weeks ago thinking about how ZFS could play a role on the Solaris desktop.

In particular, I think ZFS snapshots would be really great for the desktop user.

ZFS snapshots, if you're not familiar with them, allow you to save the state of the files and directories on your filesystem at any given moment. They take up no additional disk space, and are created in an instant. At any time, you can visit all of the files that existed at the time you took the snapshot, allowing you to peer into the past (and perhaps recover an older copy of that file that you might have deleted by mistake)

We don't yet have much desktop integration for ZFS though: we do offer an excellent command line user interface and the web-based ZFS Adminstration GUI - while both are very capable, neither are aimed at the casual desktop end-user.

Well, here's what I think the future looks like:

Tim's ideas about future ZFS desktop integration

In this image, you can see a folder called "Documents" open on the desktop. I've just hit a hotkey, which has made that folder tilt backwards a little, and all of those slightly faded folders behind it have telescoped out into the distance - each corresponds to a folder in a snapshot of that filesystem that I've taken in the past. You can also see that files which differ between snapshots have been shaded different colours. We still need to write code to label each snapshot window, and come up with a nice way to toggle between the windows, but then we're done ! (although I'm not sure how well this would scale with many snapshots - perhaps older snapshots could be reduced in size..)

Of course, that screenshot was faked, but with technology like Looking Glass 3D, the future probably isn't that far away.

I'm impatient though, so I wanted to bring the future a little closer :-) I wrote some quite simple ZFS integration for Nautilus, the GNOME File Manager, which you can try on Solaris today!

Just download and extract this tarball to your home directory, then navigate to any folder on a ZFS filesystem in the GNOME File Manager. Right click in that window, and choose the scripts menu entry, you'll then see four new menu options:

  • ZFS: Open snapshots (which corresponds to the screenshot below)
  • ZFS: Take a snapshot
  • ZFS: List snapshots (which also allows you to open a single snapshot)
  • ZFS: Destroy a snapshot

Here's what it looks like in action:

Tim's current implementation of ZFS desktop integration

Of course, if you try running those commands on a non-ZFS filesystem, the system will report an error message.

You will need the ZFS File System Management profile in order to use some of those features, specifically the "Take a snapshot" and "Destroy a snapshot" commands - you can add that profile using:

usermod -P "ZFS File System Management" [your username]

(you may need to log out and log back in for the changes to apply)

While thinking about ZFS on the desktop, I realised there's a few other things that we may need in order to get really nice desktop integration (apart from a C implementation of the ideas above! Shell scripts are nice for prototyping, but they're a bit slow..) In particular, I haven't implemented the zfs rollback functionality, allowing you to instantly revert your filesystem to a saved snapshot.

At the moment, in order to rollback to a snapshot, we need to unmount the filesystem first, which is difficult if you have it open in a file manager window. I've logged RFE 6421210 about that. Also, if your home directory actually resides on an NFS-shared directory, you don't get to use ZFS in all it's glory (though of course, you do get to take advantage of it's performance & stability, and your friendly neighbourhood sysadmin can now sleep at night) - all the same, I logged RFE 6421209.

We'd be interested in hearing what you think about this, so all comments are welcome - do you think this would be useful ?

I'm already finding ZFS snapshots wonderful, here's hoping this sort of GUI integration will find it's way onto everybody's desktop! And if you thought Solaris was just for servers, then you probably need to get up to date!

Note: As you can probably tell from the dates on the screenshots, I wrote this a while back, but just wanted to pass the idea around a few folks in Sun before I posted this. In the meantime, there's been an interesting discussion on opensolaris-discuss about this very topic! Well, how's this for ZFS desktop integration guys ?!

Update 8th August 2006: So, Apple it seems has just announced something awfully similar to the ideas I mentioned here - check out Time Machine. Do I get an ice-cream for doing this before them ? :-)

Update 16th August 2006: Updated the tarball above to fix a problem with the "ZFS: Open Snapshots" command when in a folder that contains other ZFS filesystems. We now open only snapshots for that filesystem, not snapshots of child filesystems of that filesystem.

This blog copyright 2009 by timf