2

I have two hard disks with movie files on them and I need them to have the same contents.

I'm using rsync to make sure that disk B has the same files on it as disk A, and it seems to be transferring everything.

I have added around 10 new movies to disk A and all I wanted was for rsync to quickly note which ones were new and copy them.

What I'm doing is

rsync -rv -P /Volumes/DISK_A/Film/ /Volumes/DISK_B/Film/

(both locally mounted USB disks) and I assumed it would skip 99% of the files and only transfer across the new additions.

But it seems to be transferring everything:

Alien/Alien (1979).avi
   735027200 100%   17.24MB/s    0:00:40 (xfer#2, to-check=329/333)
Alien/Aliens (1986).avi
   945698816 100%   16.27MB/s    0:00:55 (xfer#3, to-check=328/333)
Animated/Aladdin (1992).avi
   869096258 100%   16.67MB/s    0:00:49 (xfer#5, to-check=325/333)

and those movies were already there both on source and destination.

The files are the same, the details look exactly the same if I do ls -la, same permissions, owner, size etc.

Is rsync having to do some kind of deep check of the bytes in the file in order to see whether it's truly the same? Because it's pretty slow and I don't need it to do that.

What I really want is an rsync command which means 'copy files on source which don't exist on destination and ignore every other factor.'

TIA.

2
  • 3
    Could run the rsync with the --itemize and --dry-run flag and post the first lines? Are both filesystems the same? Also, a ' ls -l' for some of the files that would be transferred (on both systems) might help explain your issue. – Eduardo Trápani Dec 13 '20 at 3:26
  • 1
    ls -l on source and destination for one or two files that are being repeatedly copied please. What filesystem is source and destination? – roaima Dec 13 '20 at 8:56
1

It sounds like the flag you're looking for is --ignore-existing

3
  • 3
    That flag should almost never be needed, and particularly it's not needed here. Think about the scenario where a file is only partly copied. This flag with tell rsync not to revisit it to fix the copy – roaima Dec 13 '20 at 9:03
  • 1
    i'm answering the question as asked, "an rsync command that copies files on source which don't exist on destination and ignores every other factor" – Fox Dec 13 '20 at 11:00
  • Thanks, I accepted this as the answer, it really was what I needed. – AmbroseChapel Dec 19 '20 at 3:58
3

You're missing either the --archive (-a) or --times (-t) flags. Without one of those rsync won't track the change time and so it cannot bypass files that look like they're already been copied

rsync -avP  /Volumes/DISK_A/Film/ /Volumes/DISK_B/Film/

or

 rsync -rtvP /Volumes/DISK_A/Film/ /Volumes/DISK_B/Film/

Note that because you're copying locally, the clever part of rsync is disabled: you will either get a full copy or it's already copied. Unlike a network copy there's no ability to transfer only the missing/changed parts

2
  • Hi, thanks, even with those flags it still didn't work but that's probably because of different filesystems, see comments below the original post. – AmbroseChapel Dec 19 '20 at 4:01
  • @AmbroseChapel tell us the filesystems and you'll get a correct answer. For example if FAT is involved there is a necessary workaround to cope with its 2 second timestamp granularity. Also be aware that the first full copy with -a will be fixing up the timestamps; thereafter it will skip the files. – roaima Dec 20 '20 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.