<div dir="ltr"><div>Hello;<br><br>I thought this is worth sharing;<br><br><br>rsync(1) is a remarkably versatile program. At its simplest, you can use it as a bulk-copying tool:<br>
<br>
rsync --archive --delete --verbose <src-dir>/ <dst-dir>/<br>
<br>
except it works equally well between machines:<br>
<br>
rsync --archive --delete --verbose <host>:<src-dir>/ <dst-dir>/<br>
<br>
or<br>
<br>
rsync --archive --delete --verbose <src-dir>/ <host>:<dst-dir>/<br>
<br>
Inter-machine transfers are done securely via SSH.<br>
<br>
But it is more robust than either “cp -a” (for local copies) or “scp 
-rp” (for remote copies), because if the transfer should be aborted 
part-way for any reason (e.g. a network link going down for an 
inter-machine transfer), you can resume the transfer from where it left 
off just by re-executing the *exact same* rsync command. rsync 
automatically figures out that the destination directory has stuff in it
 that doesn’t need to be copied again, and goes from there.<br>
<br>
This is because rsync is actually a tool for answering the question 
“given an existing directory <src> and a directory <dst>, 
what is the minimum that has to be done to <dst> to make it an 
exact copy of <src>?”. And it manages to do this with a minimum of
 network traffic. Thus, for example, it can pick up small changes to a 
large file *without* having to transfer the entire file across the 
network to compare it with the other version. The algorithm for doing 
this was invented by Andrew Tridgell (a name which may be familiar as 
one of the principal SAMBA developers) and published in 1999 as part of 
his PhD thesis.<br>
<br>
Thus, rsync is useful for doing full backups, and also incremental 
backups. Given a directory containing a previous backup, rsync can bring
 it up-to-date with the latest state of the source directory. 
Alternatively, if you want to maintain snapshots of the state of that 
directory at previous points in time, you can use the --copy-dest or 
--link-dest options, for example<br>
<br>
rsync --archive --delete --verbose --link-dest=<previous-backup-dir>/ <src-dir>/ <new-backup-dir>/<br>
<br>
will make <new-backup-dir> a mirror of <src-dir>, but it 
will also look at <previous-backup-dir>, and any files in there 
that are copies matching the current contents of <src-dir> will be
 hard-linked into <new-backup-dir>, saving the disk space of an 
extra copy. The relevant marketing buzzword, should you want one, is 
“file-level deduping”.<br>
<br>
If you have heard of Apple’s “Time Machine” backup utility, rsync offers
 the same functionality, but in a more robust form, without requiring 
any dodgy filesystem hacks.<br>
<br>
Notice in all the examples above I use the --verbose option, so rsync 
tells me about each file it touches. You can also add the --dry-run 
option, so rsync will tell you what it would do, without actually doing 
it. Very handy for avoiding mistakes...<br>
<br>
The --verbose option may slow the transfer down a bit. For really large 
transfers, you may want to run it without --verbose (after having tested
 it will do the right thing, at least part of the way, with both 
--verbose and --dry-run, perhaps!). Then when it finishes, rerun it with
 --verbose, just to confirm that it reports nothing left to do.<br>
<br>
You can also use rsync to minimize downtime when e.g. moving an 
actively-used filesystem to a new disk. Run the initial rsync transfer 
to the new volume while the current volume is still live; files will 
change while the transfer is progress, but that’s a minor issue, you 
should still get the bulk of the data. Then stop general access to the 
old volume while rerunning the rsync to pick up all the changes since 
the previous run; this should complete a lot quicker than the first 
transfer. Then you can re-enable general access on the new volume.<br>
<br>
To minimize impact on other users of the filesystem during the initial 
transfer, use the ionice(1) command to drop rsync’s I/O priority down to
 “idle”. This way it only gets to access the disk when nobody else needs
 to, and its impact on the system becomes minimal.<br><br></div>regards,<br><div><div><div dir="ltr"><div>...............................................................</div><div>Titus Turinawe-Computer Tech<br></div><i>Email: <a href="mailto:ttituskayz16@gmail.com" target="_blank">ttituskayz16@gmail.com</a>,</i><div><i>          <a href="mailto:ttitus.turinawe@habari.co.tz" target="_blank">titus@bioscomputers.co.tz</a></i></div><div><i>Phone: +255 756258434, (0)686122151</i></div><div><span style="font-size:small;color:rgb(85,85,85);font-family:Arial,Helvetica,sans-serif,"Simplified Arabic Fixed";font-weight:bold;line-height:25.6px">"The more you ignore me, the closer I get" -- </span><a href="http://true-to-you.net/" style="font-size:small;font-family:Arial,Helvetica,sans-serif,"Simplified Arabic Fixed";font-weight:bold;line-height:25.6px" target="_blank">Morrissey</a><span style="font-size:small;color:rgb(85,85,85);font-family:Arial,Helvetica,sans-serif,"Simplified Arabic Fixed";font-weight:bold;line-height:25.6px">.</span><br></div><div><br><div><br></div></div></div></div>
</div></div>