Monday Nov 17, 2008

Going back in time with ZFS

With OpenSolaris 2008.11 just around the corner, there are a number of interest features I wanted to take for a test drive. One of them is the combination of Automatic Snapshots and the Time Slider utility.

With ZFS, taking and storing snapshots has become a very lightweight operation: they can be created almost instantly, and initially consume no additional disk space. Many Solaris users have created their own scripts to implement a backup policy based on them. So it seems natural to provide this as a standard OS service. Tim Foster has done just that, providing five SMF services to capture ZFS snapshots at regular intervals:

$ svcs auto-snapshot
STATE STIME FMRI
online 9:27:35 svc:/system/filesystem/zfs/auto-snapshot:weekly
online 9:27:39 svc:/system/filesystem/zfs/auto-snapshot:monthly
online 9:27:39 svc:/system/filesystem/zfs/auto-snapshot:hourly
online 9:27:39 svc:/system/filesystem/zfs/auto-snapshot:daily
online 9:27:40 svc:/system/filesystem/zfs/auto-snapshot:frequent

The default settings for frequency and retention policies are:

  • frequent: snapshots every 15 mins, keeping the last 4
  • hourly: snapshots every hour, keeping the last 24
  • daily: snapshots every day, keeping the last 31
  • weekly: snapshots every week, keeping the last 4
  • monthly: snapshots every month, keeping the last 12
They rely on cron to schedule the jobs. Simple concept, and avoids custom shell scripts and manual editing in /var/spool/cron/crontabs. As SMF services, they can be managed and monitored like other OS services, so they are easier to maintain.

How do you turn this on? While this could be done by setting the com.sun:auto-snapshot property to true on the target file system(s), there's a Time Slider Setup GUI (under System/Administration in the menu) to make things easier. You can choose to run auto-snapshots for all file systems, or select individual ones. For the icing on the cake, a time slider has been integrated into GNOME's Nautilus file manager, so you can "travel back in time" to see individual files from any of your snapshots. See Erwann's Chénedé's blog for details, including screen shots.

I often need to recover older version of documents to undo recent changes, only to discover that I forgot to save a copy. If you're like me, these new tools are a great time saver. Turn the service on, and let it do the work for you.

Note: In the OpenSolaris 2008.11 development builds (snv_101a_rc1b in my case) there is an issue with the zfssnap role not being able to run cron jobs. If you try this on early access bits, apply the changes suggested here. Check the services' logs at /var/svc/log/ for troubleshooting.

About

I am a member of Sun's ISV Engineering organization, collaborating with ISVs and Open Source communities to advance the Solaris platform.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today