UPDATE: Reading this again, I see that it was not a good question. I think I should've asked something like how reliable is
rsync -aP --dry-run /origin /dest?. Of course that the most reliable won't be the fastest way of checking data integrity.
As the answers gently explain what rsync does with these options (and some failure scenarios) and tell from what diff does, I'll keep this question as it is.
The problem is: I copied a 340 GB folder and I wanted to check if the copy was successful. The copy was made using
rsync -aP /origin /dest from one ext4 partition to another ext4 partition.
I know that using
diff -r /origin /dest to compare the origin and destination directories would take a very (very very) long time. Then I thought I could use
rsync -aP --dry-run /origin /dest to compare the directories... And it took 5 seconds(!). (I used
time before the command to measure it.)
rsync -aP showed only the "sending incremental file list" message, and nothing else (it'd list differing files or files that were not copied), I conclude that it is the fastest and most reliable way to check whether two directories are identical. (As long as
rsync -a option was used, files and directories are also identical in terms of owner, permissions and modification time...
Am I right? Is
rsync -aP --dry-run /origin /dest the fastest and most reliable way to verify whether directories are identical?