The main documentation repository for the 🍭☁️ https://lollipopcloud.solutions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

borg.md 2.0KB

Borg Backups

The BETTER backup solution.

BE MINDFUL OF RUNNING BORG. IT CAN CAUSE PROBLEMS WITH DISK IOPS AND RAM USAGE. BEST USED WHEN THE MACHINE IS KNOWN TO BE IDLE!!!

Inspiration / Further Reading

Install

Note: we are downloading pre-built borg images from the main lollipop cloud servers in this step instead of building it from scratch

arm32v7 boards


wget -O /usr/local/bin/borg https://dl.lollipopcloud.solutions/api/download/borg/borg-1.1.7-arm32v7-debian-stretch

arm64v8 boards


wget -O /usr/local/bin/borg https://dl.lollipopcloud.solutions/api/download/borg/borg-1.1.7-arm64v8-debian-stretch

All boards


chmod a+x /usr/local/bin/borg

Initialize Backup Repo

Note: assumes you have a /tank on external disk


cd /tank/backup
borg init --encryption none . # No crypto/auth for speed (see docs for more infos)

Backup Script

Setup a backup script that backs up everything (note the excludes) to the initialized repository.

Run /root/borg_backup.sh any time you want to take a backup.


cat > /root/borg_backup.sh <<EOF
#!/bin/sh
REPOSITORY=/tank/backup

# Backup all of /home and /var/www except a few
# excluded directories
/usr/local/bin/borg create -v --progress --stats -C lzma,3 \\
    \$REPOSITORY::backup-\`date +%Y-%m-%d-%H%M\` \\
    / \\
    --exclude /run \\
    --exclude /snapshots \\
    --exclude /tank \\
    --exclude /scratch \\
    --exclude /swap \\
    --exclude /proc \\
    --exclude /sys \\
    --exclude /var/lib/schroot/mount \\
    --exclude /var/lib/lxcfs \\
    --exclude /var/lib/docker \\
    --exclude /mnt

# Use the 'prune' subcommand to maintain 7 daily, 4 weekly
# and 6 monthly archives.
/usr/local/bin/borg prune -v --list \$REPOSITORY \\
    --keep-daily=7 \\
    --keep-weekly=4 \\
    --keep-monthly=6

EOF

chmod a+x /root/borg_backup.sh