piframe/docs/restic.md

61 lines
1.5 KiB
Markdown
Raw Normal View History

# Backups via restic
The below commands will setup a **local** backup of your photo frame using ```restic```.
## Important Considerations
* ```restic``` can use a bit of memory, you'll want at least 2Gb of ram on your Raspberry Pi to use this setup
* This setup does **NOT** include photos as part of the backup to keep backup sizes down
* This seutp assumes you have cron setup and runs the backup at 0700 every day
## Setup
``` sh
########################################
# restic backups
########################################
pacman -S restic
btrfs subvolume create /tank/backup
restic init -r /tank/backup
cat > /root/restic_backup.sh <<EOF
#!/bin/bash
MACHINE=picture-frame
ZONE=root
export RESTIC_REPOSITORY=/tank/backup/
export RESTIC_PASSWORD=testing1234
/usr/bin/restic backup -v -q \
--tag $MACHINE --tag $ZONE \
/ \
--exclude /run \
--exclude /snapshots \
--exclude /tank \
--exclude /scratch \
--exclude /proc \
--exclude /sys \
--exclude /var/lib/schroot/mount \
--exclude /var/lib/docker \
--exclude /var/lib/lxcfs \
--exclude /mnt \
--exclude /root/.cache \
/usr/bin/restic forget -v \
--tag $MACHINE --tag $ZONE \
--keep-daily=7 \
--keep-weekly=4 \
--keep-monthly=12 \
--keep-yearly 1
# This can take a very, very long time
/usr/bin/restic prune && /usr/bin/restic check
EOF
chmod a+x /root/restic_backup.sh
crontab -e
0 7 * * * /root/restic_backup.sh
```