meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:rsync [2021/01/19 09:43] – created niziaklinux:rsync [2025/03/30 19:56] (current) niziak
Line 1: Line 1:
 ====== rsync ====== ====== rsync ======
 +
 +===== get changes to separate dir =====
 +
 +Option ''--compare-dest'' also compare destination files relative to DIR.
 +> If DIR is a relative path, it is relative to the destination directory
 +
 +So to restore changes between remote DST and current folder ''.'' but save 
 +restored files in ''_RESTORED_BACKUP'' folder:
 +<code bash>
 +rsync --dry-run -v -ra -P -i --compare-dest=.. ${DSTHOST}:/backup/ _RESTORED_BACKUP
 +</code>
 +
 +===== print why =====
 +
 +rsync want to transfer - add ''-i'' option (''--itemize-changes''). Usefull also with ''-n'' ''--dry-run''.
 +
 +===== local replication =====
 +
 +[[https://superuser.com/questions/307541/copy-entire-file-system-hierarchy-from-one-drive-to-another|Copy entire file system hierarchy from one drive to another]]
 +
 +<code bash>
 +rsync -avxHAXS --numeric-ids --info=progress2 / /new-disk/
 +</code>
 +
 +<code>
 +-a  : all files, with permissions, etc..
 +-v  : verbose, mention files
 +-x  : stay on one file system
 +-H  : preserve hard links (not included with -a)
 +-A  : preserve ACLs/permissions (not included with -a)
 +-X  : preserve extended attributes (not included with -a)
 +-S, --sparse                handle sparse files efficiently
 +
 +To improve the copy speed, add -W (--whole-file), to avoid calculating deltas/diffs of the files. 
 +</code>
  
 ===== between two remotes ===== ===== between two remotes =====