diff options
Diffstat (limited to 'public/.local/bin/laptop-backup.sh')
| -rwxr-xr-x | public/.local/bin/laptop-backup.sh | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/public/.local/bin/laptop-backup.sh b/public/.local/bin/laptop-backup.sh index 0fcd0cd..64f39b0 100755 --- a/public/.local/bin/laptop-backup.sh +++ b/public/.local/bin/laptop-backup.sh @@ -1,6 +1,18 @@ #!/bin/bash # Fast backup using rsync +# +# This script is meant to be executed manually every so often (weekly, monthly). +# If an automatic solution where to be made (e.g., run daily via cron job). +# Then make sure the rsync target is always the same (e.g., minipc:/mnt/backup) +# and the `--delete` flag is NOT used (you'll need to figure out a way to +# "purge" duplicated files in the backup storage every so often). +# +# Steps: +# 1. Connect external storage device and get the block device path (`lsblk`) +# 2. Run this script +# +# See also: http://wiki.pulse15/index.php?title=Backup if [ $# -ne 2 ]; then echo "Usage: $(basename "$0") /dev/sdX backup" @@ -13,10 +25,14 @@ if [ "$(id -u)" -ne 0 ]; then fi rsync_options="-auvP --delete" +# path of the device (block device file) (e.g., /dev/sda) device=$1 +# cryptsetup name (e.g., backup) name=$2 -# Note: `name` (nor `device`) should not contain spaces +# FIXME +# Everything breaks if `name` or `device` contain spaces. Exit if that's the +# case. cryptsetup open --type luks $device $name if [ $? -ne 0 ]; then @@ -24,7 +40,8 @@ if [ $? -ne 0 ]; then exit 1 fi mount /dev/mapper/$name /mnt/$name -# TODO: stop backing up /var. Backup is just for Postgres and Mediawiki. +# TODO +# Stop backing up /var. Backup is just for Postgres and Mediawiki. # `/var` is used by too many applications. Specialy pacman that clutters it # with cached binaries. rsync $rsync_options /var /mnt/$name # <10G |
