[CentOS] cannot access file: Input/output error

Tue May 9 21:24:27 UTC 2017
Styma, Robert (Nokia - US/Phoenix) <robert.styma at nokia.com>

> I have a file on a backup usb drive that I get the following error:
> 
> # ls -ls P*
> ls: cannot access Power usage.xls: Input/output error
> 
> How can I delete this file so that the nightly backup will write out the
> current version to the backup drive?
> 
> I tried:
> 
> # rm -f Power\ usage.xls
> rm: cannot remove `Power usage.xls': Input/output error
> 
> Which you can see did not work.
> 
> thanks
You mention this is a USB drive.  Input/output error means something is wrong.  Possibly seriously.

The blkid command should tell you if this is a FAT32 file system or some flavor of file system.   It will also tell you the device being mounted.   Eg.  /dev/sdc1 

 If it is FAT32, you would want to unmount it and plug it into a Windows box and run chkdsk or scandsk on it.  If it has been formatted to a Linux type file system, unmount it and use fsck to scan the disk for errors with a command similar to "fsck /dev/sdc1".     Again blkid or "df -k -l" will tell you the device name.  Make sure the device is unmounted when you run fsck or bad things will happen to your data.

You might also want to try "smartctl -a /dev/sdc"    
This will give you warnings if the disk is beginning to fail.
Again, I am using /dev/sdc as an example.