Rsync: Difference between revisions

From David's Wiki
No edit summary
Line 19: Line 19:
* <code>-X</code> preserve extended attributes
* <code>-X</code> preserve extended attributes
* <code>-q</code> quiet
* <code>-q</code> quiet
==Exclude==
Add <code>--exclude</code> to your call.
;Notes
* Exclude typically uses a pattern. If you want to exclude from the root of the transfer, prepend <code>/</code>.
*: E.g <pre>rclone --exclude "/project/node_modules" project /some/other/dir/</pre>
* Add <code>--exclude</code> before <code>--stats</code> and <code>--delete</code> if you want it to work.

Revision as of 02:49, 13 June 2020

See Archwiki:rsync and rsync(1) - Linux man page

System Backups

  • Create a script and add it to your crontab -e

Basic Backup

#!/bin/bash

TARGET_FOLDER=<your target for backup>
EXCLUSIONS='--exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"}'

sudo rsync -aAXq /  ${EXCLUSIONS} \ "${TARGET_FOLDER}"
Flags
  • -a archive mode
  • -A preserve ACLs (access control lists)
  • -X preserve extended attributes
  • -q quiet

Exclude

Add --exclude to your call.

Notes
  • Exclude typically uses a pattern. If you want to exclude from the root of the transfer, prepend /.
    E.g
    rclone --exclude "/project/node_modules" project /some/other/dir/
  • Add --exclude before --stats and --delete if you want it to work.