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 {}?

3
  • Check mount options of target FS, obviously even root cannot copy to readonly FS Apr 1 at 12:50
  • 1
    @user1700494 that produces a different error, “Read-only file system”. Apr 1 at 12:53
  • What's the actual filename? /bla/bla is not even in /usr/share, is that intentional? Same for /lol/kek which is not in /tmp/FILES.
    – wjandrea
    Apr 2 at 14:56

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.