Skip to content

Bash that backs up your LXD container (https://www.ubuntu.com/containers/lxd) leveraging Minio Client (https://www.minio.io/) (in place of rclone) to any S3-compatible cloudstore.

Notifications You must be signed in to change notification settings

systemlevel/lxdbackup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 

Repository files navigation

LXD Backup script

This Bash script backs up your LXD container (https://www.ubuntu.com/containers/lxd) leveraging Minio Client (https://www.minio.io/features.html) (in place of rclone) to any S3-compatible cloudstore.

What does it do:

  • This scripts creates a backup image from a snaphot from your LXC container that is managed with LXD.
  • The script will upload your image to any S3-compatible cloudstore with Minio Client (mc).
  • Online backup of your LXC container
  • Creates an easy and ready to use LXC image to import with the LXC import command.

Requirements:

  • Tested with LXD 3.0 and higher.

What it does not cover:

  • Create a constant database backup, this does not work with backups.
  • Handle your data retention

Installation instructions

You can run the script from the commandline, or place it in your cron.

Prerequisites:

Install it by cloning this repostory on your LXC host:

git clone https://github.com/systemlevel/lxdbackup.git

Then copy the lxdbackup to your $path:

cd lxdbackup && cp lxdbackup /usr/bin/

Make it executable:

chmod +x /usr/bin/lxdbackup

Then test it with:

lxdbackup container-name

How do I set it automatically?

Use a cronjob like this to backup your container every day of the week on 01:10:

10 1 * * * flock -n /tmp/lxdbackup.lock lxdbackup container-name

How do I restore a container?

Download your container image from your cloudstorage and import it with LXC or even import it directly if your cloudstorage provides a HTTP(S) download for your image.

lxc image import <file> --alias <name>

Import from HTTPS directly:

lxc image import https://cloudrkt.com/lxdbackup --alias restored-image

About

Bash that backs up your LXD container (https://www.ubuntu.com/containers/lxd) leveraging Minio Client (https://www.minio.io/) (in place of rclone) to any S3-compatible cloudstore.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%