What should I include and exclude with rsync to back up my system?

So, the --exclude-from file, will be:

var/tmp/
var/cache/

and use rsync like this:

rsync -aAv --delete --stats --exclude-from /excludes /home /var /usr/local /etc /Backup/

Include / (the root filesystem), and include the root of any other filesystem you want to back up (for example, if /home is on a separate partition, include it as well). Use the -x option to exclude all other filesystems: in-memory filesystems like /proc and /sys, mounted removable media, remote filesystems, etc.

Exclude the files you don't want to back up. /tmp is a common candidate, maybe also /var/tmp, some directories under /var/cache, etc.

Backup space is expensive, so you may not want to back up easily-restored files such as programs installed from packages. So you should exclude /usr except /usr/local. See Rsync filter: copying one pattern only for an introductory guide to rsync include and exclude lists. You'll want something like

rsync -ax --exclude='/tmp/*' --include=/usr/local --exclude=/usr / backup:

Tags:

Backup

Rsync