unable to delete file - rm: cannot remove Input/output error

94,092

Solution 1

Looks like the filesystem has some errors on it. Do full scandisk /checkdisk from windows. (scan disk for errors)

Solution 2

The same circumstance I met. I am pretty sure I am going to delete the directory. So I try to use rm -rf XXX and also Shift + Delete to remove but both failed because of the same error. Interestingly, I fixed it by right clicking the directory Move to Trash and then Empty Trash. Hope works for you too.

Solution 3

If it is an NTFS or FAT file system and you don't have access to Windows just copy the files that you want to keep from the USB drive onto your hard drive. Then format the USB drive again using GPARTED or similar partition manager to NTFS or FAT. Followed by copying all the files back onto the USB drive. Worked for me.

Solution 4

A workaround that thankfully worked for me was to plug the drive into a Windows system and delete the offending files and folders using Shift + Delete (immediate delete without Recycle Bin).

After that, the issue seemed to be resolved when the drive was returned to Ubuntu.

Solution 5

I'm on PopOS. It happened to me when I unplugged the external disk before letting the OS flush. I could fix this issue by opening the GUI file manager -> right-click -> delete the parent folder. This time GUI was smarter.

Share:
94,092
unknown_boundaries
Author by

unknown_boundaries

Updated on September 18, 2022

Comments

  • unknown_boundaries
    unknown_boundaries over 1 year

    Some file is in my NTFS file system which I can't delete. It's giving this error:

    rm: cannot remove `zigBqC04': Input/output error
    

    Any other files also could not be copied in that folder and showing error message as:

    Error opening file 'file-path': Input/output error
    

    Any solution.

  • unknown_boundaries
    unknown_boundaries almost 11 years
    I also tried as a root but still can't.
  • Csabi Vidó
    Csabi Vidó almost 11 years
    That's probably the best one can do without damaging the proprietary filesystem or replacing the filesystem.
  • Sarah Szabo
    Sarah Szabo over 5 years
    @staticd As of 2019, is this still the best solution? I'm using the latest version of KDE, and am more interested in a *buntu specific solution.
  • parthagar
    parthagar over 4 years
    Thanks, worked for me too. Looks like this sort of delete only deletes the information of the directory from the partition table and rm tries to delete by overwriting the sectors
  • parsa2820
    parsa2820 over 4 years
    worked for me too. such a odd solution!!! :)
  • Klesun
    Klesun over 4 years
    'scandisk' is not recognized as internal or external command, operable program or batch file did you mean CHKDSK perhaps?
  • ThePhi
    ThePhi over 4 years
    Yeah, I'd like to know why this workaround is working also...
  • cipricus
    cipricus about 4 years
    Windows checkdisk has the bad habit of deleting/hiding files and folders that seem erroneous in Windows but not in Linux
  • cipricus
    cipricus about 4 years
    not working in my case
  • PatrickT
    PatrickT almost 4 years
    item was moved to trash, but cannot empty the trash...
  • nirala
    nirala about 3 years
    You sir are gnius i.imgflip.com/v0su9.jpg
  • Pavel Komarov
    Pavel Komarov almost 3 years
    Doesn't work if the external drive is way bigger than any other drive I've got.
  • darksoulsong
    darksoulsong over 2 years
    Shift + Delete did the trick, where rm -rf filename failed. Thank you.
  • ThunderBird
    ThunderBird over 2 years
    Pop OS, you say?
  • Lajos
    Lajos over 2 years