SD Card I/O error

7,361

Typically, I/O errors mean the system has run into an unrecoverable hardware error. Any files on an I/O error-ing volume should be considered lost.

With that said, data recovery is still possible (albeit a bit hard). Fortunately, there are a few utilities that can help you out:

  • ddrescue
    Ddrescue is a special utility that can be used to read as much as possible from faulty volumes. If you run this, I would highly recommend you write to an image file, and work off that for any other recovery operations (if any are even possible).
  • photorec
    While its name implies it's just for photos, photorec can often be used to recover a lot more from a drive if given the chance. It likely won't be able to recover data from any erroring sectors of your device, but it might be able to salvage some things.
  • dd
    DD (humorously known as Data Destroyer) is a builtin utility of most - if not all - modern Linux systems. At worst, you can try to use dd to make an image of your flash drive, which might allow some more advanced recovery tools (or for a file manager) to run succesfully. Be sure you're specifying the commands right, otherwise you will learn exactly why this is known as Data Destroyer.

If recovery is impossible, you may be able to recover the card by using dd and other utilities to overwrite the entire disk with zeros. This has been known (in some rare cases) to actually bring a drive back to live (albeit, losing the drive's contents in the progress). However, it's almost always a better idea to just get a new drive. Once a drive has failed, it loses any semblance of trust it ever had.

Share:
7,361

Related videos on Youtube

qwr
Author by

qwr

Tried Unity and then KDE, back to Unity GNOME now

Updated on September 18, 2022

Comments

  • qwr
    qwr over 1 year

    Running fsck.fat /dev/block/mmcblk0p1, the device of my faulty SD Card, I get this:

    fsck.fat 3.0.28 (2015-05-16)
    Read 512 bytes at 0:Input/output error
    

    Does this mean the files are permanently unreadable?

    Running fsck returns the following:

    e2fsck: Attempt to read block from filesystem resulted in short read while trying to open /dev/mmcblk0p1
    Could this be a zero-length partition?
    

    ddrescue can't save anything. Output of df:

    Filesystem     1K-blocks     Used Available Use% Mounted on
    udev             4002028        0   4002028   0% /dev
    tmpfs             805008     9496    795512   2% /run
    /dev/sda5      176456296 55779936 111689840  34% /
    tmpfs            4025024   598760   3426264  15% /dev/shm
    tmpfs               5120        4      5116   1% /run/lock
    tmpfs            4025024        0   4025024   0% /sys/fs/cgroup
    /dev/sda1          98304    51376     46928  53% /boot/efi
    tmpfs             805008       92    804916   1% /run/user/1000
    /dev/mmcblk0p1  15343104 13967392   1375712  92% /media/qwr/9016-4EF8
    

    Update: The situation gets stranger. On my Windows machine, it seems like the entire SD card is readable. However, copying files is extremely slow, with occasional returns to regular transfer speed. I managed to copy files that I was mainly after (photos taken after my last backup) but after certain point Windows Explorer would not proceed in copying no matter how long I waited.

    I went back to Ubuntu and to my surprise, fsck.fat actually ran successfully. Running it several times gives some combination of the following: Has a large number of bad entries. (128/133), Free cluster summary wrong (42991 vs. really 43267), Orphaned long file name part, Contains a free cluster (144584). Assuming EOF., Start does point to root directory. Deleting dir. ddrescue is working well right now, so I will let it keep running for now.

    Curiously it seems like hibernating and un-hibernating, or suspending and resuming, and waiting might let Ubuntu ddrescue rescue a fair amount.

    • sudodus
      sudodus about 7 years
      It worth trying a few things to get the card 'back to life'... When ddrescue cannot read your card, it is probably damaged beyond repair, 'bricked'. Sometimes a card or pendrive is 'only' readable, which is a first stage in the failing process. It is called 'gridlock'. Is this the case or is it neither readable nor writable? See the following link and links from it for further details, askubuntu.com/questions/894095/…
    • sudodus
      sudodus about 7 years
      Continue to save all files, that are important (when running in Windows). After that try to overwrite the whole drive with zeros. This might be possible with mkusb according to this link, help.ubuntu.com/community/mkusb/wipe#Wipe_the_whole_device . I have improved the speed of several USB pendrives and a few cards that way. Install mkusb according to this link, help.ubuntu.com/community/mkusb