Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A dead simple backup ecosystem for our miserable LXD containers.


./ [-p <prefix>] [<container>...]

Create a complete backup tarball in the current directory containing all partial backup tarballs from the specified list of containers.

|-- <hostname>_<container1>_<timestamp>.tar.gz
|-- <hostname>_<container2>_<timestamp>.tar.gz
|-- <hostname>_<container3>_<timestamp>.tar.gz

If no containers are specified, then all available slave scripts will be triggered.


  • -p <prefix> Add a prefix to the generated tarball filename. The format will be <hostname>_<prefix>_<timestamp>.tar.gz.

Protip! The last line of the output is the filename of the freshly created backup.

Get started

A container that we want to backup needs to have its own script slaves/ where example is the name of the container.


The master script ( is responsible for giving orders to the slave scripts and harvesting the backup archives.


The slave scripts (slaves/*.sh) are the container-specific scripts that do the actual backup work. That's why they're called slaves you know.


Here's a script template to get started:

function main {
    d "Stopping some service..."
    systemctl stop some.service || { e "Could not stop some service."; exit 1; }

    d "Backing stuff up..."
    tar cvf "$ARCHIVE" file1 file2 file3 || { e "Something went south."; exit 1; }

    d "Starting some service..."
    systemctl start some.service || { e "Could not start some service."; exit 1; }

function d {
    echo "$(date '+%b %d %H:%M:%S') $(hostname): $*"

function e {
    >&2 echo "$(date '+%b %d %H:%M:%S') $(hostname): $*"


You get the general idea.

Protip! Make sure that your slave script exits with a non-zero status if it cannot create the tarball for some reason.

Environment variables

The following environment variables are available inside slave scripts:

  • ARCHIVE: Path to the target tarball file that the slave shall create.