rsync question
Ken D'Ambrosio
ken at jots.org
Tue Mar 9 21:54:18 EST 2021
On 2021-03-09 21:29, Bruce Labitt wrote:
> A maybe not so smart rsync question...
>
> If one uses rsync -avz src/bar /disk2 will that copy over
> everything from src/bar and create a directory bar on disk2? What if
> src/bar has other users or root? In other words, does the -a mean that
> it will preserve ownership and links and copy to /disk2? Just don't
> know if I need sudo or not.
>
> I dumbly did a copy. Well, that didn't preserve permissions or
> attributes. So deleting that... Since I'm trying to back up 100's of
> GB, thought I'd ask. This is taking a long time, even with USB3 drives
> and nvme.
The '-a' flag is one of the few flags that actually means the same thing
for both rsync and cp -- and does much the same thing, too. You should
be able to use cp -av /src/bar /disk2 and have it copy
attributes/permissions. You need the "sudo" in there to preserve
ownership, as non-root can't assign other users' ownerships to the
files. The main reason I might recommend "cp" over "rsync" is simply
because I find "cp" a little less confusing -- what "rsync" does can
vary depending on whether or not there are trailing slashes and so
forth, and I never quite remember which is which. But the best thing
about rsync is that if it barfs in the middle, you just up-arrow, and it
starts over from where you left off. As with "cp", if you want the
ownerships preserved, don't forget the "sudo". Note that unless you're
transiting a network, I'd leave the "-z" off, because it'll just slow
you down (substantially).
-Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/pipermail/gnhlug-discuss/attachments/20210309/000ddbe3/attachment.html
More information about the gnhlug-discuss
mailing list