From c286db300ea993077f4a08e63399757ebf230cb4 Mon Sep 17 00:00:00 2001 From: Mitsuo Tokumori Date: Fri, 15 Dec 2023 13:25:52 -0500 Subject: Rename backup script --- local/bin/backup_desktop.sh | 38 -------------------------------------- local/bin/laptop-backup.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 38 deletions(-) delete mode 100755 local/bin/backup_desktop.sh create mode 100755 local/bin/laptop-backup.sh diff --git a/local/bin/backup_desktop.sh b/local/bin/backup_desktop.sh deleted file mode 100755 index dffaf96..0000000 --- a/local/bin/backup_desktop.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# Fast backup using rsync - -if [ $# -ne 2 ]; then - echo "Usage: $(basename "$0") /dev/sdX backup" - exit 1 -fi - -if [ "$(id -u)" -ne 0 ]; then - echo "This script must be run as root." - exit 1 -fi - -rsync_options="-auvP --delete" -device=$1 -name=$2 - -# Note: `name` (nor `device`) should not contain spaces - -cryptsetup open --type luks $device $name -if [ $? -ne 0 ]; then - # bad device - exit 1 -fi -mount /dev/mapper/$name /mnt/$name -# 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 -rsync $rsync_options /home /mnt/$name # <900G -rsync $rsync_options /etc /mnt/$name # <20M -echo "Backup complete." -df -h | grep -E "${name}|var|home|etc" -umount /mnt/$name -cryptsetup close $name - -echo "All done. Check \`$ lsblk\` before unplugging the storage device." diff --git a/local/bin/laptop-backup.sh b/local/bin/laptop-backup.sh new file mode 100755 index 0000000..dffaf96 --- /dev/null +++ b/local/bin/laptop-backup.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Fast backup using rsync + +if [ $# -ne 2 ]; then + echo "Usage: $(basename "$0") /dev/sdX backup" + exit 1 +fi + +if [ "$(id -u)" -ne 0 ]; then + echo "This script must be run as root." + exit 1 +fi + +rsync_options="-auvP --delete" +device=$1 +name=$2 + +# Note: `name` (nor `device`) should not contain spaces + +cryptsetup open --type luks $device $name +if [ $? -ne 0 ]; then + # bad device + exit 1 +fi +mount /dev/mapper/$name /mnt/$name +# 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 +rsync $rsync_options /home /mnt/$name # <900G +rsync $rsync_options /etc /mnt/$name # <20M +echo "Backup complete." +df -h | grep -E "${name}|var|home|etc" +umount /mnt/$name +cryptsetup close $name + +echo "All done. Check \`$ lsblk\` before unplugging the storage device." -- cgit v1.2.3