tips.paddyonline.net

If you need tips & tricks, here they are...

Joomla! AddThis

Share

Rsync

Article Index

Rsync

Rsync is one of those utilities that doesn't come nativity normally. Some flavors do install it during installation of the operating system while others demand you to install it.

You don't have to install it but it is good if you need to do some special tasks.

It's meant as a utility to synchronize two directories which in turn can be done in various ways. It can do it between two servers/computers or between two local directories or even as a server for others to synchronize with your local package.


Basic Command with Options

rsync -narvchtSR --delete-during --numeric-ids --exclude=.nfs\* --exclude=.snap --rsh="ssh -l root" :<source_directory> <destination_directory>


How to use Rsync to syncronize two directories

rsync -arvchtS --no-R --delete-during --numeric-ids

Examples

# rsync -arvchtS --no-R --delete-during --numeric-ids blaj/blaj2 blaj1
sending incremental file list
blaj2/
blaj2/du
blaj2/hej

sent 173 bytes received 54 bytes 454.00 bytes/sec
total size is 0 speedup is 0.00

# rm blaj/blaj2/hej
# rsync -arvchtS --no-R --delete-during --numeric-ids blaj/blaj2 blaj1
sending incremental file list
blaj2/
deleting blaj2/hej

sent 74 bytes received 16 bytes 180.00 bytes/sec
total size is 0 speedup is 0.00


Rsync and Basic options

rsync -narvchtSR --delete-during --numeric-ids --exclude=.nfs\* --exclude=.snap --rsh="ssh -l root" :<source_directory> <destination_directory>

  • R = use relative path names
  • z = compress file data during the transfer
  • r = recurse into directories (need to be specified by itself)
  • a = archive mode; equals -rlptgoD (no -H,-A,-X)
    • l = copy symlinks as symlinks
    • p = preserve permissions
    • g = preserve group
    • o = preserve owner (super-user only)
  • v = increase verbosity
  • t = preserve modification times
  • c = skip based on checksum, not mod-time & size
  • h = output numbers in a human-readable format
  • n = perform a trial run with no changes made
  • S = handle sparse files efficiently
  • delete-during = receiver deletes during xfer, not before
  • numeric-ids = don't map uid/gid values by user/group name
  • exclude = exclude files matching PATTERN

 

Add comment

Security code
Refresh

Please consider supporting our efforts.


We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.