Skip to content

A systemd service for backing up your root drive to an external disk using borg with support for LVM Snapshots.

License

Notifications You must be signed in to change notification settings

cuedo/borg-backup-service

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

# Install BorgBackup
sudo apt install borgbackup # Debian based distros
sudo pacman -S borg # Arch
sudo yum install borgbackup # Fedora

# Set up a Borg repository
borg init --encryption=repokey /path/to/repo

# Installing borg-backup-service
sudo mkdir /etc/borg-backup
sudo git clone --depth 1 https://github.com/itay-grudev/borg-backup-service.git /etc/borg-backup

sudo ln -s /etc/borg-backup/borg-backup.service /etc/systemd/system/borg-backup.service
sudo systemctl daemon-reload

# To enable the automatic backup when the external disk is plugged in
sudo ln -s /etc/borg-backup/40-backup.rules /etc/udev/rules.d/40-backup.rules
sudo udevadm control --reload

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

Usage

sudo systemctl start borg-backup
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:

borg create $BORG_OPTS \
  --exclude /opt \
  ...

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.

About

A systemd service for backing up your root drive to an external disk using borg with support for LVM Snapshots.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%