I would support @brucew 's answer. rsync is a very powerful tool if you just want to copy files to another drive in case of data loss (which is what @NerdyGentleman wants to do, if I understand correctly).
Of course all the proposed solutions offer nice GUIs and are pretty simple to use.
Just for the sake of completeness, here is my “backup solution”.
I have 2 scripts that use rsync to backup both my home and my / (root) folders.
DISCLAIMER: I wrote these scripts to the best of my knowledge. They work very good for me but I do not take any responsibility for any problems you might encounter. Do not run these scripts unless you fully understand what they do!!
backup-home.shdoes an incremental backup, which means that files that were deleted in/home/myuserare not deleted in the backup, so the backup will grow over time.backup-root.shdoes the same to my root partition, but as an 1:1 copy, which means that the backup is always the “same” as the source. Deleted files in the source directory are deleted from the backup, too.
For both scripts there is an exclude-list, so you can exclude folders that you do not want to backup. For example I don’t want to backup many temporary folders, my Steam Library and so on. You have to take a look at these files and edit them according to your needs.
Usage:
- Copy the *.sh and the according exclude list to a folder of your liking (I use
~/.rsync) - Edit these variables so that they contain the correct paths:
SOURCEDIR: contains the path of the folder to backupTARGETDIR: contains the path where to backup the folder toEXCLUDELIST: contains the path to the exclude listLOGDIR: contains the path to the folder where the log files are written (I use~/.rsync/logs). The scripts keep 30 logs of the last backups. When there are more than 30 logs, the “first” ones are deleted, so you always have 30 logs in the folders.
- Edit the exclude lists according to your liking
- Make the scripts executable
Both files are currently set to dry run, which means that nothing is copied, all you get is an output of what would be copied if you actually run the script.
To make them work, you have to comment out the DRY-RUN command and remove the comment from the REAL BACKUP command like so:
# DRY-RUN:
# rsync --dry-run -axv --progress -s --exclude-from="$EXCLUDELIST" "$SOURCEDIR" "$TARGETDIR" >> "$LOGFILE" 2>&1
# REAL BACKUP
rsync -axv -s --exclude-from="$EXCLUDELIST" "$SOURCEDIR" "$TARGETDIR" >> "$LOGFILE" 2>&1
Here is the code:
If you want to automatically run the scripts daily, you have to create system-d services and timers. Sound complicated, but is actually just a case of creating 4 files and starting the services:
Show me how to do it...
file: /etc/systemd/system/backup-home.service
[Unit]
Description=Daily Backup Script
[Service]
Type=simple
ExecStart=/home/USER/.rsync/backup-home.sh
file: /etc/systemd/system/backup-home.timer
[Unit]
Description=Run backup-home.service daily at 11:00
[Timer]
OnCalendar=*-*-* 11:00:00
Persistent=true
Unit=backup-home.service
[Install]
WantedBy=timers.target
file: /etc/systemd/system/backup-home.service
[Unit]
Description=Daily Backup Script
[Service]
Type=simple
ExecStart=/home/USER/.rsync/backup-home.sh
file: /etc/systemd/system/backup-root.timer
[Unit]
Description=Run backup-root.service daily at 10:00
[Timer]
OnCalendar=*-*-* 10:00:00
Persistent=true
Unit=backup-home.service
[Install]
WantedBy=timers.target
and then you start the services like so:
sudo systemctl daemon-reload
sudo systemctl enable --now backup-home.timer
sudo systemctl enable --now backup-root.timer