Rescue data from corupted FAT32 micro SD card

7,594

Solution 1

Use ddrescue to make a copy of the SD card - you don't want to work off of the original.

You can use TestDisk or Autopsy to try recovering the filesystem or a tool like scalpel to carve files from the disk.

Here are some basic commands:

ddrescue

ddrescue is used in a similar fashion to dd. Namely:

ddrescue /dev/XXX /home/user/Desktop/copy_of_sd_card /home/user/Desktop/logfile

The logfile will store the information about any sectors it had trouble reading.

Source.

TestDisk

You can then use TestDisk to try to retrieve files from the image:

testdisk /home/user/Desktop/copy_of_sd_card

It has a wizard-like interface. as well. A full guide is here.

Autopsy

Autospy is a graphical interface over the sleuth kit. When you run it, it creates a web interface.

This site has a simple walkthrough on how to use Autopsy.

Also, see this

Solution 2

PhotoRec

As long as files on your SD card haven't been physically overwritten there is always possible to recover them, even if SD card is reformatted. I recommend using the PhotoRec program, it is easy to use command line tool.

Share:
7,594
Dusan Milosevic
Author by

Dusan Milosevic

Updated on September 18, 2022

Comments

  • Dusan Milosevic
    Dusan Milosevic almost 2 years

    I used it on android and it just stopped working. I want to extract data before I format it. Here's the output of sudo dosfsck -w -r -l -a -v -t /dev/mmcblk0p1:

    fsck.fat 3.0.26 (2014-03-07)
    fsck.fat 3.0.26 (2014-03-07)
    Checking we can access the last sector of the filesystem
    Boot sector contents:
    System ID "android "
    Media byte 0xf0 (5.25" or 3.5" HD floppy)
           512 bytes per logical sector
         32768 bytes per cluster
            32 reserved sectors
    First FAT starts at byte 16384 (sector 32)
             2 FATs, 32 bit entries
       2022912 bytes per FAT (= 3951 sectors)
    Root directory start at cluster 2 (arbitrary size)
    Data area starts at byte 4062208 (sector 7934)
        505668 data clusters (16569729024 bytes)
    16 sectors/track, 4 heads
             0 hidden sectors
      32370688 sectors total
    Checking file /
    /
      Contains a free cluster (2). Assuming EOF.
    FAT32 root dir starts with a bad cluster!
    

    Is it possible to save data? Thanks!

  • Dusan Milosevic
    Dusan Milosevic almost 10 years
    I'm not used to that programs. Can you give me specific commands? Thanks!
  • Moshe
    Moshe almost 10 years
    Sure, I just added some.
  • Cord Kaldemeyer
    Cord Kaldemeyer about 7 years
    This saved my day since I already tried testdisk but did not find the option within.