Re: Re: General method for copying a partition
> rsync -a /media/ /mnt/
This is good. Note that the trailing / on /media/ is significant.
> OR
> find /media -exec cp -a {} /mnt \;
No, that is both wrong and very inefficient:-
Wrong
-----
Try this:
mkdir /tmp/media /tmp/mnt
mkdir -p /tmp/media/a/b/c
touch /tmp/media/a/aa /tmp/media/a/b/bb /tmp/media/a/b/c/cc
find /tmp/media -exec cp -a {} /tmp/mnt \;
find /tmp/media /tmp/mnt
/tmp/media
/tmp/media/a
/tmp/media/a/b
/tmp/media/a/b/c
/tmp/media/a/b/c/cc
/tmp/media/a/b/bb
/tmp/media/a/aa
/tmp/mnt
/tmp/mnt/a
/tmp/mnt/a/b
/tmp/mnt/a/b/c
/tmp/mnt/a/b/c/cc
/tmp/mnt/a/b/bb
/tmp/mnt/a/aa
/tmp/mnt/b
/tmp/mnt/b/c
/tmp/mnt/b/c/cc
/tmp/mnt/b/bb
/tmp/mnt/c
/tmp/mnt/c/cc
/tmp/mnt/aa
/tmp/mnt/bb
/tmp/mnt/cc
/tmp/mnt/media
/tmp/mnt/media/a
/tmp/mnt/media/a/b
/tmp/mnt/media/a/b/c
/tmp/mnt/media/a/b/c/cc
/tmp/mnt/media/a/b/bb
/tmp/mnt/media/a/aa
Inefficient
-----------
That will execute a separate cp process for every file and directory
under /media, which could have a big impact if there are many files.
Consider using
find <stuff> | xargs <command>
or
find <stuff> -exec <command \+
(note \+ instead of \; - see find(1) man page).
Regards,
Reply to: