Discussion:
zfs-auto-snapshot backup issue
Mark Pace
2011-10-06 19:46:06 UTC
Permalink
I've been fighting with getting the backup part of the zfs-auto-snapshot working properly on Nexenta Core 3.x. I can get the snapshotting going, but as soon as I run one of the backup jobs it works the first time, it does not work after that, and it then prevents the snapshotting from working again on that filesystem's *name*. If I rename the zfs filesystem the auto-snapshotting works again. If I change it back to the old name, the auto-snapshotting stops working.

I've set the logging to verbose and that doesn't seem to provide any extra hints about what is going on.

Here's the manifest for the backup instance. I have also tried setting backup to incremental with no changes:

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='system/filesystem/zfs/auto-snapshot' type='service' version='0'>
<dependency name='multi-user' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/milestone/multi-user'/>
</dependency>
<dependency name='cron' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/cron'/>
</dependency>
<dependency name='zfssnap-role' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/zfssnap-roleadd'/>
</dependency>
<exec_method name='start' type='method' exec='/lib/svc/method/zfs-auto-snapshot start' timeout_seconds='0'>
<method_context>
<method_credential user='zfssnap' group='daemon'/>
</method_context>
</exec_method>
<exec_method name='stop' type='method' exec='/lib/svc/method/zfs-auto-snapshot stop' timeout_seconds='0'>
<method_context>
<method_credential user='zfssnap' group='daemon'/>
</method_context>
</exec_method>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='transient'/>
</property_group>
<property_group name='general' type='framework'>
<property name='action_authorization' type='astring'/>
<property name='value_authorization' type='astring'/>
</property_group>
<property_group name='zfs' type='application'>
<propval name='avoidscrub' type='boolean' value='false'/>
<propval name='backup' type='astring' value='none'/>
<propval name='backup-lock' type='astring' value='unlocked'/>
<propval name='backup-save-cmd' type='astring' value=''/>
<propval name='fs-name' type='astring' value='Not set'/>
<propval name='interval' type='astring' value='Not set'/>
<propval name='keep' type='astring' value='all'/>
<propval name='label' type='astring' value=''/>
<propval name='offset' type='astring' value='Not set'/>
<propval name='snapshot-children' type='boolean' value='false'/>
<propval name='verbose' type='boolean' value='false'/>
</property_group>
<instance name='pdx-backup-01' enabled='true'>
<property_group name='zfs' type='application'>
<propval name='avoidscrub' type='boolean' value='true'/>
<propval name='backup' type='astring' value='full'/>
<propval name='backup-lock' type='astring' value='unlocked'/>
<propval name='backup-save-cmd' type='astring' value='/usr/sbin/zfs recv -du -F backup-01/repl/zfs-01'/>
<propval name='fs-name' type='astring' value='//'/>
<propval name='interval' type='astring' value='days'/>
<propval name='keep' type='astring' value='14'/>
<propval name='label' type='astring' value='backup-01'/>
<propval name='offset' type='astring' value='0'/>
<propval name='period' type='astring' value='1'/>
<propval name='snapshot-children' type='boolean' value='true'/>
<propval name='verbose' type='boolean' value='true'/>
</property_group>
<property_group name='general' type='framework'>
<property name='action_authorization' type='astring'/>
<property name='value_authorization' type='astring'/>
</property_group>
</instance>
<stability value='Unstable'/>
<template>
<common_name>
<loctext xml:lang='C'>ZFS automatic snapshots</loctext>
</common_name>
<description>
<loctext xml:lang='C'>This service provides system support for taking automatic snapshots of ZFS
filesystems.

In order to use this service, you must create a service instance per set of automatic snapshots you want to take.

The on starting a service instance, a cron job corresponding to the properties set in the instance is created on the host. This cron job will regularly take snapshots of the specified ZFS filesystem.

On stopping the service, that cron job is removed.

We also have the ability to perform backups, done using the 'zfs send' command. A property set in the service called 'backup-save-cmd' can be configured as the command used to save the backup stream. See the zfs(1M) man page for an example. The backups can be either 'full' backups, or 'incremental' backups - for each incremental backup, a full backup must be configured first. If for some reason an incremental backup fails, a full backup is performed instead.

By default, snapshots will be taken of any datasets resident on pools that are currently being scrubbed or resilvered. This can behaviour can be changed using the zfs/avoid scrub service property.

Care should be taken when configuring backups to ensure that the time granularity of the cron job is sufficient to allow the backup to complete between invocations of each backup. We perform locking to ensure that two backups of the same filesystem cannot run simultaneously, but will move the service into 'maintenance' state should this occur.</loctext>
</description>
</template>
</service>
</service_bundle>

Here are the log entries around renaming a working filesystem name back to its old name to make it fail:

Successful snapshot of the filesystem (which has been renamed so that it will snapshot):
zfs-auto-snap: [ID 702911 daemon.notice] Taking recursive snapshot zfs-01/test/***@zfs-auto-snap:frequent-2011-10-03-18:30

When I rename the above file system back to "zfs-01/test/snapper" rather than "zfs-01/test/snaptest":
zfs-auto-snap: [ID 702911 daemon.notice] Taking recursive snapshots of

Any help is greatly appreciated.


Thanks!
Mark Pace
--
This message posted from opensolaris.org
Loading...