All 1 entries tagged Snapshot

No other Warwick Blogs use the tag Snapshot on entries | View entries tagged Snapshot at Technorati | There are no images tagged Snapshot on this blog

September 17, 2010

automated zfs snapshot of zone test

Writing about web page http://wikis.sun.com/display/OpenSolarisInfo/How+to+Manage+the+Automatic+ZFS+Snapshot+Service

While I was working on a perl script for automating ZFS snapshots I happened to discover the automatic ZFS snapshot service for opensolaris by Tim Foster.

http://wikis.sun.com/display/OpenSolarisInfo/How+to+Manage+the+Automatic+ZFS+Snapshot+Service

Which is, of course, exactly what I need – the problem is that I need it to run on Solaris 10, for which it is not currently available. However, this thread on Tim’s blog (especially the comments) suggest that it is possible to get the service working, without the time slider element on Solaris 10:

http://blogs.sun.com/timf/entry/zfs_automatic_snapshots_0_12

So, I attempted yesterday to get this installed, compiled into an SVR4 package with pkgmk and pktrans and install it on Solaris 10. It was remarkably straightforward and early testing shows it to work very well.

First, get the ‘bits’ and make the pkg as described on Tim’s blog, using hg to clone and make to create the pkg tree.

$ hg clone ssh://anon@hg.opensolaris.org/hg/jds/zfs-snapshot

Before actually creating the package, there are 3 changes as detailed by Eli Kleinamm, again on the blog comment : http://blogs.sun.com/timf/entry/zfs_automatic_snapshots_0_12

These changes are made in
~/auto-snapshot/zfs-snapshot/src/lib/svc/method

# vi zfs-auto-snapshot

Change:

1) The shell to run in /usr/dt/bin/dtksh

2) Remove on line 511 and 517 the -o com.sun:auto-snapshot-desc=”$EVENT”,

and

3)Remove the space/tab on line 970 between $SWAPVOLS and
$(echo
 SWAPVOLS=”$SWAPVOLS$(echo $swap | sed -e ’s#/dev/zvol/dsk/##’)”

Once done, run make – it should create a pkg format file tree for you in the current working directory – read the Makefile, its not long.

Next, create the pkg datastream for portability

$ pkgtrans -s . /var/spool/pkg/SUNWzfs-auto-snapshot.pkg SUNWzfs-auto-snapshot
Transferring <SUNWzfs-auto-snapshot> package instance

This will now simply pkgadd to a Solaris 10 system. I can’t help but think this is particularly awesome, but as a colleague pointed out – this now really has to go through some very extensive testing before any rollout. I still think its a lot better than my dangerous perl scripting attempts.

This will now (if I can get agreement internally) be added as a package to the standard build for all Solaris 10 hosts using ZFS within our control.

The service provides 5 SMF services for managing automatic snapshots. These are:

svc:/system/filesystem/zfs/auto-snapshot:monthly
svc:/system/filesystem/zfs/auto-snapshot:weekly
svc:/system/filesystem/zfs/auto-snapshot:daily
svc:/system/filesystem/zfs/auto-snapshot:hourly
svc:/system/filesystem/zfs/auto-snapshot:frequent

Enable these to have snapshots taken at a regularity as suggested by the name. Each has properties to tune, the most notable being how many snapshots to retain;

-bash-3.00$ svccfg -s auto-snapshot:daily listprop zfs/keep
zfs/keep  astring  31

-bash-3.00$ svccfg -s auto-snapshot:frequent listprop zfs/keep
zfs/keep  astring  4

-bash-3.00$ svccfg -s auto-snapshot:frequent listprop zfs/period
zfs/period  astring  15

The defaults for daily and frequent being 1 months worth of dailies and 4 frequents. Frequent is defined initially as once every 15 mins as shown by the zfs/period property.

Whether a ZFS dataset is snapshot’ed or not is controlled by a user level ZFS property com.sun:auto-snapshot which can be true or false for a dataset and com.sun:auto-snapshot:frequent, com.sun:auto-snapshot:daily, etc, etc properties for each periodicity as required. These are inherited, so it is probably a good idea to set com.sun:auto-snapshot to false at the root of a pool and then change the required sub-datasets to true as needed. Perhaps an example would help;

-bash-3.00$ pfexec zfs set com.sun:auto-snapshot=true datapool/zfstestz1_ds
-bash-3.00$
-bash-3.00$ pfexec zfs set com.sun:auto-snapshot=false rpool              
-bash-3.00$ pfexec zfs set com.sun:auto-snapshot=true rpool/export
-bash-3.00$ pfexec zfs set com.sun:auto-snapshot:frequent=true rpool/export
-bash-3.00$ pfexec zfs set com.sun:auto-snapshot:frequent=true datapool/zfstestz1_ds
-bash-3.00$

<getting bored with pfexec for each cmd>
-bash-3.00$ pfexec bash
bash-3.00# zfs set com.sun:auto-snapshot=false rpool/dump
bash-3.00# zfs set com.sun:auto-snapshot=false rpool/swap

bash-3.00# cat /etc/release
                       Solaris 10 10/09 s10x_u8wos_08a X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                           Assembled 16 September 2009
bash-3.00#
bash-3.00# svcs -a |grep snapshot
disabled       17:59:54 svc:/system/filesystem/zfs/auto-snapshot:monthly
disabled       17:59:54 svc:/system/filesystem/zfs/auto-snapshot:weekly
disabled       17:59:54 svc:/system/filesystem/zfs/auto-snapshot:daily
disabled       17:59:54 svc:/system/filesystem/zfs/auto-snapshot:hourly
online         18:00:44 svc:/system/filesystem/zfs/auto-snapshot:event
online         18:09:18 svc:/system/filesystem/zfs/auto-snapshot:frequent
bash-3.00#

bash-3.00#
bash-3.00# zfs list -t snapshot | grep frequent
datapool@zfs-auto-snap_frequent-2010-09-23-1809                   0      -  28.0K  -
datapool/zfstestz1_ds@zfs-auto-snap_frequent-2010-09-23-1809      0      -  28.0K  -
rpool/export@zfs-auto-snap_frequent-2010-09-23-1809               0      -    23K  -
rpool/export/home@zfs-auto-snap_frequent-2010-09-23-1809          0      -   954K  -

bash-3.00#
bash-3.00# pkginfo SUNWzfs-auto-snapshot
application SUNWzfs-auto-snapshot ZFS Automatic Snapshot Service
bash-3.00#

bash-3.00# date
Thursday, 23 September 2010 18:15:48 BST

bash-3.00# zfs list -t snapshot | grep frequent
datapool@zfs-auto-snap_frequent-2010-09-23-1809                   0      -  28.0K  -
datapool@zfs-auto-snap_frequent-2010-09-23-1815                   0      -  28.0K  -
datapool/zfstestz1_ds@zfs-auto-snap_frequent-2010-09-23-1809      0      -  28.0K  -
datapool/zfstestz1_ds@zfs-auto-snap_frequent-2010-09-23-1815      0      -  28.0K  -
rpool/export@zfs-auto-snap_frequent-2010-09-23-1809               0      -    23K  -
rpool/export@zfs-auto-snap_frequent-2010-09-23-1815               0      -    23K  -
rpool/export/home@zfs-auto-snap_frequent-2010-09-23-1809          0      -   954K  -
rpool/export/home@zfs-auto-snap_frequent-2010-09-23-1815          0      -   954K  -

I think this should prove to be very useful for us, I would be very interested, as usual in hearing your comments.

Paul.


October 2019

Mo Tu We Th Fr Sa Su
Sep |  Today  |
   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 31         

Search this blog

Tags

Galleries

Most recent comments

  • Started sorting out new vers for sparc: http://blogs.warwick.ac.uk/mariamaccallum/entry/apache_249_i… by Maria MacCallum on this entry
  • Solaris 11.1 is slightly different, I only had to do this before starting ipfilter: svccfg –s setpro… by Maria MacCallum on this entry
  • Really useful information, thanks a lot! I do a NAT using IPFILTER and all was working good, until I… by Nilton on this entry
  • Paul, Thanks for your information. It got me started quickly. I have discovered , thought I've not s… by Tom C on this entry
  • Are you familiar with the Monty Python sketch? by Ian Eiloart on this entry

Blog archive

Loading…
RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder
© MMXIX