mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-22 07:11:55 +00:00
75 lines
4.8 KiB
HTML
75 lines
4.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>Handbook - Quick rsync</title>
|
|
<link rel="stylesheet" type="text/css" href="../../css/main2.css" />
|
|
</head>
|
|
<body>
|
|
<h2 id="tophead">CUCC Expedition Handbook - rsync Quick</h2>
|
|
|
|
<h1>Quick Reminder - rsync</h1>
|
|
<h2><em>Manual</em> Version Control using rsync</h2>
|
|
<p>This is NOT a tutorial. This is a set of reminders for people who already know all this stuff.
|
|
|
|
|
|
<dl>
|
|
<dt>expofiles (all the big files and documents)</dt>
|
|
|
|
<p>Photos, scans (logbooks, drawn-up cave segments) (This was about
|
|
40GB of stuff in 2019 which you probably don't actually need locally).
|
|
<p>If you don't need an entire copy of all of it, then it is probably best to use Filezilla/ftp to
|
|
copy just a small part of the filesystem to your own machine and to upload the bits you add to or edit.
|
|
Instructions for installing and using Filezilla are found in the expo user instructions for
|
|
uploading photographs: <a href="uploading.html">uploading.html</a>.
|
|
|
|
<p> To sync all
|
|
the files from the server to your local expofiles directory on your laptop:</p>
|
|
|
|
<pre style="font-size: small"><code>rsync -nazv --delete-after --exclude="thumbs/" --exclude="*.???.xml" --exclude="*.jpeg.xml" expo@expo.survex.com:expofiles/ /home/expo/expofiles</code></pre>
|
|
|
|
<p>To sync the local expofiles directory back to the server after you have edited updates (e.g. scanned some hand-drawn surveys into expofiles/surveyscans/ (but only if your machine runs Linux):</p>
|
|
|
|
<pre style="font-size: small"><code>rsync -nazv --delete-after /home/expo/expofiles/surveyscans/2019/ expo@expo.survex.com:expofiles/surveyscans/2019</code></pre>
|
|
|
|
then CHECK that the list of files it produces matches the ones you absolutely intend to delete forever! ONLY THEN do it without the "-n" option. "-n" is the same as "--dry-run" which shows you the overwriting changes but doesn't actually do them.
|
|
|
|
<p>Note that the target folder <em>has no trailing slash</em> but that the source folder <em>does</em>. Important.
|
|
|
|
<p>Always:
|
|
<ul>
|
|
|
|
<li>do a dry-run of rsync from the server to your laptop immediately before you do an upload to the server
|
|
<li>use <var>--delete-after </var>
|
|
<li>never use <var>--prune-empty-dirs</var> because we often need an empty folder, e.g. when preparing for the next expo we create several empty folders.
|
|
<li>work at the minimum scope of folders you need, e.g. within expofiles/photos/ or expofiles/surveyscans/ not for the whole of expofiles all at once.
|
|
<li>take exaggerated care with the placement of the final slash in directory parameters to the rsync. Get it wrong and you duplicate things instead of updating them and it takes ages to sort out.
|
|
</ul>
|
|
|
|
<p>(do be <b>incredibly</b> careful not to delete piles of stuff then rsync back, or to get the directory level of the command wrong - as it'll all get deleted on the server too, and we will not have backups if these are recent files!). It's <b>absolutely vital</b> to use <var>rsync --dry-run --delete-after</var> first to check what would be deleted.
|
|
<p>If your version of rsync produces output for every folder it sees, even if it is not update, then pipe the output through
|
|
<pre style="font-size: small"><code>| grep -v "/$"</code></pre>
|
|
to hide the folders which have a termial slash.
|
|
|
|
<p>If you are using rsync from an NTFS folder on a Windows machine (even if you are using WSL to do it) you will <em>not necessarily</em> get all the files cleanly as some legal Linux filenames are incompatible with Windows. What will happen is that
|
|
<ol>
|
|
<li>rsync will invisibly change the names as it downloads them from the Linux expo server to your Windows machine, but
|
|
<li>then it forgets what it has done and
|
|
<li>when you next try to rsynchronise using rsync, it will
|
|
<li>re-upload all the <em>renamed files</em> and maybe delete the originals <em>even if you have touched none of them</em>.
|
|
<li>This pollutes the server and would break links between survex files and drawings file.
|
|
</ol>Now there won't be any problems with simple filenames using all lowercase letters and no funny characters (except for "con.jpg" and similar of course*), but we have nothing in place to stop anyone creating (using Linux) an incompatible filename of that sort somewhere in that 40GB or of detecting the problem at the time. So be extra, extra careful and religiously use the <var>-n (DRY RUN)</var> setting and manually check all changes before running rsync without -n.
|
|
|
|
<p>(We may also have an issue with rsync not using the appropriate user:group attributes for files pushed back to the server. This may not cause any problems, but watch out for it.)</p>
|
|
<p>* CON is an MS-DOS identifier for the CONSOLE and it is still an illegal Windows filename.
|
|
It's <a href="https://www.howtogeek.com/fyi/windows-10-still-wont-let-you-use-these-file-names-reserved-in-1974/">not the only thing</a> like that.
|
|
</dl>
|
|
|
|
|
|
|
|
<hr />
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|