cp Input/output error

I get a strange Input/output error when I try as root to copy an image file as follows…

apollo:/home/ion/DATA/PHOTOS/AMSTER2015 # ls
DSC04392.JPG  DSC04393.JPG  DSC04394.JPG  DSC04395.JPG  DSC04396.JPG  DSC04397.JPG
apollo:/home/ion/DATA/PHOTOS/AMSTER2015 # mount /dev/sdb9 /mnt/hd
apollo:/home/ion/DATA/PHOTOS/AMSTER2015 # ls /mnt/hd/PHOTOS/AMSTER2015
apollo:/home/ion/DATA/PHOTOS/AMSTER2015 # 
apollo:/home/ion/DATA/PHOTOS/AMSTER2015 # cp DSC04392.JPG /mnt/hd/PHOTOS/AMSTER2015
cp: cannot create regular file ‘/mnt/hd/PHOTOS/AMSTER2015/DSC04392.JPG’: Input/output error

How do I go about diagnosing the problem? Thanks in advance.

Try reading from disk to nowhere to just verify it can be done:


cat DSC04392.JPG >> /dev/null

If that works, then perhaps you have a writing problem. Try putting
arbitrary data where that file would go, preferably in a similar quantity
(MBs):


dd if=/dev/zero of=/mnt/hd/PHOTOS/AMSTER2015/test0 bs=1048576 count=10


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

Hexedit shows no white spaces of the file names being copied.

00000000   44 53 43 30  34 33 39 32  2E 4A 50 47  0A 44 53 43  30 34 33 39  DSC04392.JPG.DSC0439
00000014   33 2E 4A 50  47 0A 44 53  43 30 34 33  39 34 2E 4A  50 47 0A 44  3.JPG.DSC04394.JPG.D
00000028   53 43 30 34  33 39 35 2E  4A 50 47 0A  44 53 43 30  34 33 39 36  SC04395.JPG.DSC04396
0000003C   2E 4A 50 47  0A 44 53 43  30 34 33 39  37 2E 4A 50  47 0A 78 78  .JPG.DSC04397.JPG

That did the trick. It errored out. Deleting the directory and re-creating it solved the problem. Many thanks.

On 2015-07-06 13:26, ionmich wrote:

> How do I go about diagnosing the problem? Thanks in advance.

Is it an USB stick?

Run “dmesg -Tw” in a terminal, connect the stick, mount, write a file,
then paste the /new/ text in the terminal.


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

On 2015-07-06 14:26, ionmich wrote:

> That did the trick. It errored out. Deleting the directory and
> re-creating it solved the problem. Many thanks.

That means you must run fsck on that partition, before it bombs out…


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))