Skip to main content

Tools for managing zfs snapshots

Project description

Sluice is a set of tools for managing ZFS snapshots:

  • zfs-autosnapshot creates snapshots with automatically-generated names

  • zfs-copy combines zfs send and zfs receive

  • zfs-sync does one-way synchronisation of snapshots between two datasets

with several others on the way:

  • zfs-cull

  • zfs-import

  • zfs-export

Motivation / rationale

(combine with description?)

  • goals:

    • unix philosophy

      • snapshot, sync and cull can quite happily be independent operations with separate schedules

    • avoid config file

      • since tools are split up, fewer command-line options are required

      • schedule with cron/launchd and configure targets as args

      • can also use zfs user props for config

    • no requirement for remote installation (provided by weir)

Installation

Requires Python 2.7.

To install Sluice, simply:

$ pip install sluice

Usage

Create a snapshot from a strftime()-compatible date format string:

$ zfs-autosnapshot zroot/test@%Y-%m-%d
$ zfs list -t snapshot -d 1 zroot/test | tail -1
zroot/test@2015-02-10                   0       -   136Ki  -

Create a snapshot from a format string stored in the user property sluice.autosnapshot:format (or the default, %Y-%m-%dT%H%M):

$ zfs set sluice.autosnapshot:format=auto-%Y-%m-%dT%H%M%S zroot/test
$ zfs-autosnapshot zroot/test
$ zfs list -t snapshot -d 1 zroot/test | tail -1
zroot/test@auto-2015-02-10T114854       0       -   136Ki  -

Copy a snapshot:

$ zfs-copy zroot/test@2015-02-10 zroot/test-copy
$ zfs list -t all -r zroot/test-copy
NAME                          USED   AVAIL   REFER  MOUNTPOINT
zroot/test-copy              556Ki  97.0Gi   444Ki  /Volumes/zroot/test-copy
zroot/test-copy@2015-02-10   112Ki       -   136Ki  -

Perform one-way synchronisation between datasets:

$ zfs-sync zroot/test zroot/test-sync
$ zfs list -t all -r zroot/test-sync
NAME                                      USED   AVAIL   REFER  MOUNTPOINT
zroot/test-sync                          136Ki  97.0Gi   136Ki  /Volumes/zroot/test-sync
zroot/test-sync@auto-2015-02-10T114854       0       -   136Ki  -

$ zfs-autosnapshot zroot/test
$ zfs-sync zroot/test zroot/test-sync
$ zfs list -t all -r zroot/test-sync
NAME                                      USED   AVAIL   REFER  MOUNTPOINT
zroot/test-sync                          144Ki  97.0Gi   136Ki  /Volumes/zroot/test-sync
zroot/test-sync@auto-2015-02-10T114854     8Ki       -   136Ki  -
zroot/test-sync@auto-2015-02-10T121006       0       -   136Ki  -

A hold is placed on the source snapshot to prevent inadvertently deleting it and thereby breaking incremental synchronisation:

$ zfs holds zroot/test@auto-2015-02-10T121006
NAME                               TAG                          TIMESTAMP
zroot/test@auto-2015-02-10T121006  sluice.sync:zroot/test-sync  Tue Feb 10 12:10 2015

License

Licensed under the Common Development and Distribution License (CDDL).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sluice-0.2.0.dev.tar.gz (8.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page