Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
home_server:home_server_setup:other_services:rsync [2023-05-28 Sun wk21 10:31] – [An Important Notes] baumkphome_server:home_server_setup:other_services:rsync [2025-01-17 Fri wk03 12:54] (current) – [Rsnapshot] baumkp
Line 1: Line 1:
-{{tag>rsync backup linux debian ubuntu rsnapshot}}+{{tag>rsync backup linux debian rsnapshot}}
 ======Rsync====== ======Rsync======
 These are my rsync notes.  I also used to use rsnapshot, however I was unhappy with the performance of this application and moved to restic.  The original rsnapshot notes have been rolled up and moved to the bottom of this page. These are my rsync notes.  I also used to use rsnapshot, however I was unhappy with the performance of this application and moved to restic.  The original rsnapshot notes have been rolled up and moved to the bottom of this page.
Line 7: Line 7:
  
  
-====An Important Notes====+====Main rsync command usage summary====
  
 A trailing slash (/) at the end of the first argument in the rsync command: ''rsync -a dir1/ dir2'', mean “the contents of dir1”. The alternative, without the trailing slash, would place dir1, including the directory, within dir2. This would create a hierarchy that looks like: ~/dir2/dir1/[files] A trailing slash (/) at the end of the first argument in the rsync command: ''rsync -a dir1/ dir2'', mean “the contents of dir1”. The alternative, without the trailing slash, would place dir1, including the directory, within dir2. This would create a hierarchy that looks like: ~/dir2/dir1/[files]
Line 16: Line 16:
   *''-a'' is the flag for archive.  Keeps original dates and permissions on copy and also recurses, copied sub-directories and content.   *''-a'' is the flag for archive.  Keeps original dates and permissions on copy and also recurses, copied sub-directories and content.
   *''-u'' only copies source files where they are newer than destination files (based upon file modification dates)   *''-u'' only copies source files where they are newer than destination files (based upon file modification dates)
-  *''--delete'' deletes files on the destination where they are not on the source.  **//Use with care!//**+  *''%%--delete%%'' deletes files on the destination where they are not on the source.  **//Use with care!//**
   *''-n'' is for dry run, no changes are made, but proposed output is seen   *''-n'' is for dry run, no changes are made, but proposed output is seen
   *''-P'' keeps partially copies files and reports progress   *''-P'' keeps partially copies files and reports progress
Line 26: Line 26:
  
 ====rsync daemon==== ====rsync daemon====
 +++++tl;dr;|
 rsync can be installed as a daemon on a computer instance rsync can be installed as a daemon on a computer instance
  
Line 53: Line 54:
  
 ''sudo systemctl status rsync.service''   [status, start, stop, restart, reload, disable, enable] ''sudo systemctl status rsync.service''   [status, start, stop, restart, reload, disable, enable]
 +++++
  
- +====Notes on Compression option==== 
-====Compression option -z can slow down file transfer.====+Compression option -z can slow down file transfer notes as well as some examples I used 
 +++++tl;dr;|
 ''export RSYNC_SKIP_COMPRESS=3fr/3g2/3gp/3gpp/7z/aac/ace/amr/apk/appx/appxbundle/arc/arj/arw/asf/avi/bz2/cab/cr2/crypt[5678]/dat/dcr/deb/dmg/drc/ear/erf/flac/flv/gif/gpg/gz/iiq/iso/jar/jp2/jpeg/jpg/k25/kdc/lz/lzma/lzo/m4[apv]/mef/mkv/mos/mov/mp[34]/mpeg/mp[gv]/msi/nef/oga/ogg/ogv/opus/orf/pef/png/qt/rar/rpm/rw2/rzip/s7z/sfx/sr2/srf/svgz/t[gb]z/tlz/txz/vob/wim/wma/wmv/xz/zip'' ''export RSYNC_SKIP_COMPRESS=3fr/3g2/3gp/3gpp/7z/aac/ace/amr/apk/appx/appxbundle/arc/arj/arw/asf/avi/bz2/cab/cr2/crypt[5678]/dat/dcr/deb/dmg/drc/ear/erf/flac/flv/gif/gpg/gz/iiq/iso/jar/jp2/jpeg/jpg/k25/kdc/lz/lzma/lzo/m4[apv]/mef/mkv/mos/mov/mp[34]/mpeg/mp[gv]/msi/nef/oga/ogg/ogv/opus/orf/pef/png/qt/rar/rpm/rw2/rzip/s7z/sfx/sr2/srf/svgz/t[gb]z/tlz/txz/vob/wim/wma/wmv/xz/zip''
  
Line 77: Line 80:
  
 ''sudo rsync x -a -Puh /home/shared/temp/ baumkp@192.168.1.10::all/home/shared/html_kptree.net %%--%%exclude=.Trash* >tmp.txt'' ''sudo rsync x -a -Puh /home/shared/temp/ baumkp@192.168.1.10::all/home/shared/html_kptree.net %%--%%exclude=.Trash* >tmp.txt''
 +++++
  
 +====My web page copy bash batch====
 +''sudo vim Myscripts/rsync_shared.sh'' or to run ''sudo bash Myscripts/rsync_shared.sh''
 +
 +#Note this is a local only script and takes no additional batch inputs when run!
 +++++code|
 +<code bash>
 +#!/bin/bash
 +wwwpath='/home/shared/www/html'
 +workpath='/home/shared/html_kptree.net/'
 +cmd="rsync -ptoguv --chown=root:www-data --chmod=a+rwx,g+rwx,o-wx"
 +$cmd ${workpath}/styles.css ${wwwpath}
 +$cmd ${workpath}/w3.css ${wwwpath}
 +$cmd ${workpath}/index.html ${wwwpath}
 +$cmd ${workpath}/email_server_w3.html ${wwwpath}
 +</code>
 +++++
 ====some rsync flag definitions==== ====some rsync flag definitions====
 +Simply type ''rsync'' at terminal to see a complete list
 ^Flag Short^ Flag Long ^Description^ ^Flag Short^ Flag Long ^Description^
 |''-z''| ''%%--%%compress''        |compress file data during the transfer| |''-z''| ''%%--%%compress''        |compress file data during the transfer|
Line 109: Line 130:
   * * preservation of hard links is important when moving across rsnapshots backups between disks.   * * preservation of hard links is important when moving across rsnapshots backups between disks.
  
-My web page copy bash batch: 
-''sudo vim Myscripts/rsync_shared.sh'' or to run ''sudo bash Myscripts/rsync_shared.sh'' 
- 
-#Note this is a local only script and takes no additional batch inputs when run! 
-<code bash> 
-#!/bin/bash 
-wwwpath='/home/shared/www/html' 
-workpath='/home/shared/html_kptree.net/' 
-cmd="rsync -ptoguv --chown=root:www-data --chmod=a+rwx,g+rwx,o-wx" 
-$cmd ${workpath}/styles.css ${wwwpath} 
-$cmd ${workpath}/w3.css ${wwwpath} 
-$cmd ${workpath}/index.html ${wwwpath} 
-$cmd ${workpath}/email_server_w3.html ${wwwpath} 
-</code> 
  
 ---- ----
Line 141: Line 148:
  
 ====Rsnapshot==== ====Rsnapshot====
-These are some rsnapshot and related rsync notes.  They are really long! Sadly the original source was only onlie for a few years.+These are some rsnapshot and related rsync notes.  They are really long! Sadly the original source was only online for a few years.
  
 ++++Rsnapshot and Old Rsync notes, really tl;dr;| ++++Rsnapshot and Old Rsync notes, really tl;dr;|