I would use rsync:
rsync -avic --progress /data/ /data2
Note:
The trailing / on /data/ is deliberate, it ensures rsync will not create /data2/data and re-copy all your files under it. (you don't need a trailing / on /data2)
The options are:
-a which is named for "archive" but really turns on a bunch of useful options (like recursive descent into subdirs) that will imitate your cp -r command's behavior.
-v and -i make the copy verbose and show how rsync sets the permissions and ownership on the copied files, which is useful as the copy goes forward.
-c uses checksums to decide whether the data in each file should be copied. This will let rsync skip copying the file contents and only adjust the ownership/permissions on the destination files.
--progress is not required, but shows the progress copying any file contents to the destination.
The -v and -i options will make at least one line scroll in your terminal window per file. Omit them if you don't want this. You can add -n (i.e., -avicn) if you want rsync to do a verbose dry run that tells you what it would do, but doesn't make changes to the files. So a dry run with the -avicn --progress options, followed by the real thing with just the -ac --progress options may be more desirable for you.
findcould be slow in traversing the directory tree but I did come up with anrsyncanswer. – doneal24 Sep 21 '22 at 17:42sudo chown -R $USER:$USER /mnt/dataNote -R is recursion so all underlying folders also changed.sudo chmod -R a+rwX /mnt/datahttps://askubuntu.com/questions/1013677/storing-data-on-second-hdd-mounting – oldfred Sep 21 '22 at 20:27chmodsomewhere in here. – doneal24 Sep 21 '22 at 20:29-rw-r--r--permission part. – ron Sep 21 '22 at 20:38root.rootownership which was my problem – ron Sep 21 '22 at 20:39echo $USEROf if you have multiple users, it gets more complicated. – oldfred Sep 21 '22 at 21:13