SpaceCadet, (edited )
@SpaceCadet@feddit.nl avatar

Just use rsync -va

NO STOP!

The default quick check algorithm of rsync is not safe for this. It only checks filesize and modification time to determine if files are equal. After a b0rked copy, these are not to be trusted.

You should add the -c flag so that files are properly checksummed, unfortunately if you have slow storage on either end, this often negates the speed advantage of rsync.

For example, consider this example:


<span style="color:#323232;">mkdir source
</span><span style="color:#323232;">mkdir destination
</span><span style="color:#323232;">echo "hello" > source/file.txt
</span><span style="color:#323232;">echo "world" > destination/file.txt
</span><span style="color:#323232;">touch -r source/file.txt destination/file.txt
</span><span style="color:#323232;">rsync -avh source/ destination/
</span><span style="color:#323232;">cat source/file.txt
</span><span style="color:#323232;">cat destination/file.txt
</span>

Contrary to what you might expect, the rsync command copies nothing and the output at the end will show:


<span style="color:#323232;">hello
</span><span style="color:#323232;">world
</span>

If you change the rsync command in the example above to rsync -c -avh source/ destination/, it will work as expected.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #