Giter Site home page Giter Site logo

snapsync's Introduction

Snapsync

A synchronization tool for snapper

This gem implements snapper-based backup, by allowing you to synchronize a snapper snapshot directory to a different location using btrfs send and receive.

It can be used in two modes:

  • in manual mode, you run snapsync

Installation

You need to make sure that you've installed Ruby's bundler. On Ubuntu, run $ apt install bundler

Then, the following will install snapsync in /opt/snapsync

$ wget https://raw.githubusercontent.com/doudou/snapsync/master/install.sh
$ sh install.sh

The script will use sudo to get root rights when required. Add /opt/snapsync/bin to your PATH if you want to use 'snapsync' as-is. Otherwise, you will have to refer to /opt/snapsync/bin/snapsync explicitely. If it seems that you are using systemd, the script also installs snapsync's systemd service file into the system, enables and starts it.

Usage

The most common usage of snapsync is to define a remote target (for instance, a USB drive) to which the snapshots should be copied. Mount the drive manually first and do

$ snapsync init /path/to/the/drive/snapsync

This will create snapsync targets for each of the snapper configurations currently present on the system (i.e. if there is a 'home' and 'root' configurations, it will create /path/to/the/drive/snapsync/root and /path/to/the/drive/snapsync/home). The 'default' synchronization policy is used (see below for other options).

If you use systemd, the background systemd job will from now on synchronize the new target whenever it is present (i.e. as soon as it is plugged in). If you don't, or if you decided to disable the service's auto-start, run (and keep on running)

$ snapsync auto-sync

to achieve the same result. The actions taken by the systemd-managed service can be followed with

$ journalctl -f -u snapsync.service

Synchronization and cleanup policies

snapsync offers multiple synchronization-and-cleanup policies for targets. These policies determine what to copy to the target, as well as what to keep on the target.

The default policy copies everything and removes nothing. It's great at the beginning, but is obviously not a very good long-term strategy ;-)

Policies can be set at initialization time by passing additional arguments to 'snapsync init', or later with 'snapsync policy'. Run 'snapsync help init' and 'snapsync help policy' for more information.

Manual usage

If you prefer using snapsync manually, or use different automation that the one provided by auto-sync, run 'snapsync' without arguments to get all the possibilities. Targets have configuration files that allow to fine-tune snapsync's automated behaviour to that effect.

'''NOTE''' thor, the underlying library that handles snapsync's command line interface, has a bug in which the --no- prefix is often not recognized properly. Use e.g. --all=f instead of --no-all

Future development

The main two functionalities that I plan to add to snapsync are having a per-session service that provides notifications of what snapsync is doing, and remote backup (through e.g. SSH)

Development

To develop snapsync, clone this repository and install the dependencies

$ git clone https://github.com/doudou/snapsync $ cd snapsync $ bundler install --path=vendor/ $ sudo bundler exec bin/snapsync

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/doudou/snapsync.

License

The gem is available as open source under the terms of the MIT License.

snapsync's People

Contributors

doudou avatar p2004a avatar utf8please avatar

Watchers

James Cloos avatar Konstantin Tkachenko avatar

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.