rsync -a is not the same as cp -R
rsync -a is not the same as cp -R
Posted Nov 6, 2020 7:55 UTC (Fri) by mchehab (subscriber, #41156)In reply to: Deprecating scp by marcH
Parent article: Deprecating scp
> It is true that rsync can do everything but the kitchen sink but in practice there are only two rsync things you need to remember:
>
> - Use -a ("archive") always.
> - The infamous source trailing slash: on the source side, foo/ is equivalent to foo/*, including dot files
>
> And that's it, I never remember anything else. Plus who reads man pages from top to bottom? I have no idea how long most man pages are because I only search them.
You should revisit your concept and read the manuals ;-)
> tl;dr: cp -R is insane, use rsync -a. Using it more than once is not just safer it's also much faster of course: it can be used as an actual backup tool.
If you're copying big sparse file(s) (for instance, VM images) and don't use -S on rsync, you may end running out of disk space at the destination, as rsync will create a non-sparsed files at the destination. See:
$ dd if=/dev/zero of=test bs=1k seek=2048k count=1 $ rsync -a test test2 $ du -h test test2 4,0K test 2,1G test2Also, depending on the type of file permissions, "-a" is not enough. You may need other flags (-A, -H, -X).
Posted Nov 6, 2020 8:06 UTC (Fri)
by Wol (subscriber, #4433)
[Link] (3 responses)
Cheers,
Posted Nov 6, 2020 10:01 UTC (Fri)
by taneli (subscriber, #95265)
[Link]
Posted Nov 7, 2020 23:22 UTC (Sat)
by Sesse (subscriber, #53779)
[Link] (1 responses)
Posted Nov 8, 2020 0:03 UTC (Sun)
by Wol (subscriber, #4433)
[Link]
I meant, of course, hard links.
Oh - and if you don't need to preserve hard links (which I do), it's not a good idea to try. I think my rsync or cp crawled, I had so many it needed to keep track of ...
Cheers,
rsync -a is not the same as cp -R
Wol
rsync -a is not the same as cp -R
rsync -a is not the same as cp -R
rsync -a is not the same as cp -R
Wol