项目作者: itay-grudev

项目描述 :
A systemd service for backing up your root drive to an external disk using borg with support for LVM Snapshots.
高级语言: Shell
项目地址: git://github.com/itay-grudev/borg-backup-service.git
创建时间: 2018-12-30T19:01:18Z
项目社区:https://github.com/itay-grudev/borg-backup-service

开源协议:GNU General Public License v3.0

下载


Borg Backup Service

A systemd service for creating a backup of your root linux drive to an external
disk using BorgBackup with support for creating an LVM snapshot.

BorgBackup is an extremly powerful backup tool that supports deduplication,
encryption and compression.

Installation

My preffered way of installing is installing borg and placing the contents of
this repository in /etc/borg-backup.

  1. # Install BorgBackup
  2. sudo apt install borgbackup # Debian based distros
  3. sudo pacman -S borg # Arch
  4. sudo yum install borgbackup # Fedora
  5. # Set up a Borg repository
  6. borg init --encryption=repokey /path/to/repo
  7. # Installing borg-backup-service
  8. sudo mkdir /etc/borg-backup
  9. sudo git clone --depth 1 https://github.com/itay-grudev/borg-backup-service.git /etc/borg-backup
  10. sudo ln -s /etc/borg-backup/borg-backup.service /etc/systemd/system/borg-backup.service
  11. sudo systemctl daemon-reload
  12. # To enable the automatic backup when the external disk is plugged in
  13. sudo ln -s /etc/borg-backup/40-backup.rules /etc/udev/rules.d/40-backup.rules
  14. sudo udevadm control --reload

For full documentation on setting up a borg repository refer to
Borg Quick Start Guide.

Usage

  1. sudo systemctl start borg-backup
  2. sudo systemctl status borg-backup

Configuration

Add the external disk UUID to the backup.disks file, one entry per line.
Additional configuration is done in the backup.conf file.

Customisations

If you need to customise the backup script like for example excluding certain
directories from the backup modify the start.sh script.

For example to exclude /opt from the backup add:

  1. borg create $BORG_OPTS \
  2. --exclude /opt \
  3. ...

License

This code is based on the article Automated backups to a local hard drive
and is distributed under the terms of the GNU GPL v3.

Copyright Itay Grudev 2018.