Created
November 19, 2020 13:02
-
-
Save billimek/7bd900cf2b81876a16419644c97b1ffd to your computer and use it in GitHub Desktop.
quarterly 'offsite' backups scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSYNC_COMMAND="/usr/bin/rsync -ah --delete --stats" | |
DATE=`date +%Y_%m_%d` | |
# it may be necessary to mount the drive manually via something like: | |
# mount -t ext4 /dev/sdf /media/usb0/ | |
# To mount and descrypt the USB device: | |
echo "----- Decrypting drive ------" | |
cryptsetup luksOpen /dev/disk/by-uuid/47461dd7-8481-4805-aeee-0377882fe34b encrypted_backup | |
mount /dev/mapper/encrypted_backup /media/encrypted_backup | |
echo "'df' before running": | |
df -h /media/encrypted_backup | |
echo "====== Backing up /tank/media/data.bin/ ======" | |
${RSYNC_COMMAND} /tank/media/data.bin /media/encrypted_backup/data.bin | |
echo "====== Backing up /tank/data ======" | |
${RSYNC_COMMAND} /tank/data/ /media/encrypted_backup/data/ | |
echo "====== Backing up /tank/media/itunes/ ======" | |
${RSYNC_COMMAND} /tank/media/itunes/ /media/encrypted_backup/itunes/ | |
echo "====== Backing up /tank/media/Software/ ======" | |
${RSYNC_COMMAND} /tank/media/Software/ /media/encrypted_backup/Software/ | |
echo "====== Backing up /tank/media/Archive/ ======" | |
${RSYNC_COMMAND} /tank/media/Archive/ /media/encrypted_backup/Archive/ | |
echo "====== Backing up /tank/backups/ ======" | |
${RSYNC_COMMAND} /tank/backups/ /media/encrypted_backup/backups/ | |
echo "====== Backing up /tank/proxmox/dump/vzdump*${DATE}* ======" | |
${RSYNC_COMMAND} /tank/proxmox/dump/vzdump*${DATE}* /media/encrypted_backup/backups/proxmox-dumps/ | |
echo "'df' after running": | |
df -h /media/encrypted_backup | |
# To unmount the USB device: | |
echo "----- Encrypting & unmounting drive ------" | |
umount /media/encrypted_backup | |
cryptsetup luksClose encrypted_backup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSYNC_COMMAND="/usr/bin/rsync -ah --delete --stats" | |
${RSYNC_COMMAND} /tank/media/Lightroom\ Archive/ /media/usb/Lightroom/ | |
${RSYNC_COMMAND} /tank/media/Photographs/ /media/usb/Photographs/ | |
# umount /media/usb | |
# hdparm -Y /dev/sdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment