3

I read "Linux Bible 10th Edition" at 130 page. Exercise №7:

Create a /tmp/FILES directory. Find all files under the /usr/share directory that are more than 5MB and less than 10MB and copy them to the /tmp/FILES directory.

My command looks like find /usr/share -type f -size +5M -size -10M -exec cp {} /tmp/FILES \;. I ran it like usual user and got

cp: error copying '/bla/bla' to '/lol/kek': Input/output error find: '/usr/share/bla-bla': Permission denied

After that I tried to ran it as super user and got error (without Permission denied):

cp: error copying '/bla/bla' to '/lol/kek': Input/output error

Please, explain me, what the reason of that errors even when I run it as super user. Thank you.

P.S. Please, explain why command with of -exec should have empty {}?

CoderDesu
  • 145

1 Answers1

14

“Input/output error” indicates a low-level I/O error (EIO) either while reading a source file or while writing a target file. This means you have a problem with your storage; dmesg will give you more information.

Such errors are not related to privileges or permissions, which is why running cp as root doesn’t make them disappear (unlike the “Permission denied” error).

Understanding the -exec option of `find` explains the use of {} with -exec.

Stephen Kitt
  • 434,908