Rsync: Difference between revisions
Appearance
No edit summary |
|||
| Line 1: | Line 1: | ||
See [[Archwiki:rsync]] and [https://linux.die.net/man/1/rsync rsync(1) - Linux man page] | See [[Archwiki:rsync]] and [https://linux.die.net/man/1/rsync rsync(1) - Linux man page] | ||
==Getting Started== | |||
<pre> | |||
rsync -a <src> <dst> --info=progress2 | |||
</pre> | |||
;Flags | |||
* <code>-a</code> archive mode (recursive mode, preserves symlinks, permissions, times, group, owner, devices) | |||
* <code>--no-i-r</code> or <code>--no-inc-recursive</code> scans all files at the beginning rather than during the transfer | |||
* <code>--progress</code> shows per-file progress | |||
* <code>--info=progress2</code> shows overall progress during the transfer | |||
==System Backups== | ==System Backups== | ||
Revision as of 12:47, 28 July 2020
See Archwiki:rsync and rsync(1) - Linux man page
Getting Started
rsync -a <src> <dst> --info=progress2
- Flags
-aarchive mode (recursive mode, preserves symlinks, permissions, times, group, owner, devices)--no-i-ror--no-inc-recursivescans all files at the beginning rather than during the transfer--progressshows per-file progress--info=progress2shows overall progress during the transfer
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
-aarchive mode-Apreserve ACLs (access control lists)-Xpreserve extended attributes-qquiet
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/
- E.g
- Add
--excludebefore--statsand--deleteif you want it to work.
You can also use --exclude-from and point to a text file list of exclusions.