Created
January 20, 2021 13:27
-
-
Save theKAKAN/b1e37bba2e8b58b464dff46c9d10e27c to your computer and use it in GitHub Desktop.
Backup all my important files to where-ever I choose
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
# Where should we store the backups? | |
BACKUP_DIR="/mnt/backup_drive/$(hostname)/$(date -u +\"%Y-%m-%d\")" | |
# Backup /etc | |
sudo rsync -avzP /etc $BACKUP_DIR | |
# Backup /var excluding many heavy files | |
sudo rsync -avzP --exclude 'cache' \ | |
--exclude 'lib/flatpak' \ | |
--exclude 'lib/dnf' --exclude 'lib/dpkg' \ | |
--exlclude 'lib/libvirt' \ | |
--exclude 'lock' --exclude 'run' \ | |
/var $BACKUP_DIR | |
# Backup /opt and /srv | |
sudo rsync -avzP /opt $BACKUP_DIR | |
sudo rsync -avzP /srv $BACKUP_DIR | |
# Back up /usr/local since it contains mostly user-installed applications | |
sudo rsync -avzP /usr/local $BACKUP_DIR/usr | |
# I should backup /root and /home | |
sudo rsync -avzP /root $BACKUP_DIR | |
# This will backup every user's /home, so be sure to edit it if you've just vmail boxes or something only... | |
sudo rsync -avzP /home $BACKUP_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment