Making Quick Backup of Entire Linux to Remote Host with Rsync

These are my notes on how to do a quick Linux backup with Rsync. In this case, copied all files from Debian to a remote Ubuntu machine.

Rsync Backup

Here is the command line I ended up with and why;

rsync -rP / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} user@remote_host:/mnt/remote_directory

The synced directory, in this case / needs to precede excluded directories.

I haven’t used -a or “archive mode” which preserves groups, owners, modification times, etc. of files. Which is useful for system restoration, etc.

Also you can compress the whole thing with -z but haven’t bothered.

Because of -P mode (which combines progress and partial flags) you can run the same command again to update the files or continue where you left of. Note that you would need to add “–delete” if you later want to sync removed files as well.

The -r flag is recursive so pretty obvious, and must.

It took more than an hour for this command to run, which transferred a huge amount of files one-by-one, about 25GB in total size.

And that’s about it. Thanks for reading.
Will updated as necessary. David.

Leave a Comment