GithubHelp home page GithubHelp logo

zfs_transfer's Introduction

zfs_transfer

Maintain a mirror of ZFS pools over the network.

Best used together with https://github.com/zfsonlinux/zfs-auto-snapshot set up on the remote host. It should be possible to chain multiple ZFS hosts.

Below is a crontab usage example. Here the various datasets and snapshots from the host 192.168.1.14 are replicated to our local ZFS pool, using SSH (-o Compression=no -c arcfour) and caching (mbuffer) optimizations.

Parent datasets are automatically created before the initial synch, when you add a dataset.

We use 'zfs hold' to implement locking that prevents destruction of remote snapshots, that would put the synchronization process in danger.

This allows for laid-back snapshot expiry management on the remote host, since a lot of force (you need to remove the hold tag) is required to destroy the latest mutually known snapshot.

The script should be quite tolerant against various failure conditions. If you can make it better, please do!

In below crontab, the remote pool is called "backuppool", and the local site is "offsite".

The "Keep days" parameter only destroys local (offsite) snapshots. It makes sure that a hold is released, if exists, on the remote host before it goes on to destroy a local snapshot. Failure to do so, would disturb snapshot expiry on the remote host indefinitely!

MAILTO="[email protected]"
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

0 0  1   *   *     zpool scrub offsite

#                                    Hostname            Remote dataset                          Local dataset                          Hold tag       Keep days
# m h  dom mon dow   command         ------------        --------------------------------------- -------------------------------------- -------------- ------------
0 */6 *  *   *     zfs_replicate   -h 192.168.1.14    -r backuppool/virt/machines             -l offsite/virt/machines               -t offsite     -k 30
10 */6 *  *   *     zfs_replicate   -h 192.168.1.14    -r backuppool/backuppc                  -l offsite/backuppc                    -t offsite     -k 30
20 */6 *  *   *     zfs_replicate   -h 192.168.1.14    -r backuppool/timemachine               -l offsite/timemachine                 -t offsite     -k 30
50 */6 *  *   *     zfs_replicate   -h 192.168.1.14    -r backuppool/vdp                       -l offsite/vdp                         -t offsite     -k 30

zfs_transfer's People

Contributors

jvsalo avatar

Stargazers

 avatar  avatar  avatar  avatar Jack Wasey avatar Hajo Möller avatar Philipp C. Heckel avatar Rick Blundell avatar

Watchers

 avatar  avatar Rick Blundell avatar

Forkers

binwiederhier

zfs_transfer's Issues

'pigz' reported as not installed when -P/--no-pigz option given

$ sudo zfstx -P -b 512M localhost:tank/os victory/tank/os
ERROR: 'pigz' is not installed. Install it, or use --no-pigz.

And zfstx exits. Strangely, pigz is installed, and is actually used when no '-P' option is given.

Expected behavior: Pigz will be disabled. Might want to also consider just disabling pigz for localhosts as well. Keeping it enabled is likely a detriment to performance in virtually every case.

BTW, thank you. Finally a simple set of tools for this!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.