Created
May 1, 2019 15:15
-
-
Save lukas-h/80dfa0177c44933ebe73d3a2b534c3a1 to your computer and use it in GitHub Desktop.
Backup your linux system harddrive
This file contains 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
#!/bin/sh | |
# Written by Lukas Himsel <[email protected]> | |
# | |
# -> backup your complete linux system <- | |
# | |
# Variables: | |
# BACKUP_DEVICE is the *mounted* harddrive for the backup | |
# BACKUP_DATE is the actual date and it's used to create a folder | |
# with the actual date | |
# | |
# Execute: | |
# You can execute it as normal user with superuser rights (admin). | |
# | |
# Dependencies: | |
# Make sure you have installed `rsync`. | |
# If not execute `apt-get install rsync` (on Debian, Ubuntu) | |
# You also need the program `date`, integrated in the Coreutils... | |
# | |
# Resources: | |
# See https://wiki.archlinux.org/index.php/Full_system_backup_with_rsync | |
# for more infos | |
# | |
# variables | |
BACKUP_DEVICE=/media/$USER/backup # please change the path so, that it points to your backup drive | |
BACKUP_DATE=`date "+%y.%m.%d-%H:%M"` | |
# make directory for snapshot | |
sudo mkdir $BACKUP_DEVICE/$BACKUP_DATE | |
# execute rsync to create the backup | |
cd | |
sudo rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found", "/home/*/.thumbnails/*", "/home/*/.cache/mozilla/*", "/home/*/.cache/chromium/*", "/home/*/.local/share/Trash/*"} / $BACKUP_DEVICE/$BACKUP_DATE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment