SD Recover

Welcome to the SD Recover project.

The SD Recover project is developing a collection of tools to assist the recovery of files from a corrupt memory card. Initial aim of this project was to recover photographic jpeg and avi files from a corrupt SD card. However, the tools might be usable in other situations.

The tools are written in pure C and assume no non-standard libraries.

They have been tested on Linux and MacOSX, and should also run on Windows using Cygwin or MinGW/MSYS. Although developed for SD cards they should work for other memory card types.

Note that the tools do not aim to fix a broken SD card or correct its format. Nor do they aim to fix the format of any recovered file.


There are no formal releases of this software yet, but all the code is available from the subversion repository hosted at SourceForge.

  • For SDRecover at SourceForge click here


    The inspiration for this project came then I found that I had a corrupt SD memory card that had been used to take about 40 photographs and an AVI movie. The corrupt SD card would not even mount on MacOSX, Linux or Windows PCs.

    Having searched the Web, including SourceForge I found no free tools (both meanings for free) that could rescue these files. So I wrote my own tools.

    My tools were able to recover the AVI movie and all but one of my JPEG images. These tools have formed the basis of the project.

    Currently there are four command line tools:

    A current limitation of the extraction tools is that they assume the file data is contiguous. The sdrecover tool is an experiment to investigate means to overcome this limitation.

    As it turned out I found this limitation was no barrier for me as all my files were contiguous.


    All tools operate on a raw image file created using, for example, the dd command line tool.

    $ dd if=/dev/sda1 of=cardimage.img

    The if=device is the device spec for the corrupt memory card.

    The copy process may take rather along time, and depends on the size of the memory card and the speed of the interface.

    Here is the output of the command run on MacOSX:

    [mirror-doors:~/src/sd_recover] steven% dd if=/dev/rdisk1 of=cardimage.img
    494080+0 records in
    494080+0 records out
    252968960 bytes transferred in 2015.300956 secs (125524 bytes/sec)
    [mirror-doors:~/src/sd_recover] steven% 

    Use pdisk on MacOSX to find the correct value for the device spec. You need to run pdisk with root privilege. Thus, with the following example /dev/rdisk1 is the required device...

    [mirror-doors:~] steven% sudo pdisk
    Top level command (? for help): L
    pdisk: No valid block 1 on '/dev/rdisk1'
    Partition map (with 512 byte blocks) on '/dev/rdisk0'
     #:                type name               length   base      ( size )
     1: Apple_partition_map Apple                  63 @ 1        
     2:      Apple_Driver43*Macintosh              56 @ 64       
     3:      Apple_Driver43*Macintosh              56 @ 120      
     4:    Apple_Driver_ATA*Macintosh              56 @ 176      
     5:    Apple_Driver_ATA*Macintosh              56 @ 232      
     6:      Apple_FWDriver Macintosh             512 @ 288      
     7:  Apple_Driver_IOKit Macintosh             512 @ 800      
     8:       Apple_Patches Patch Partition       512 @ 1312     
     9:           Apple_HFS Untitled        234439816 @ 1824      (111.8G)
    10:          Apple_Free                         8 @ 234441640
    Device block size=512, Number of Blocks=234441648 (111.8G)
    DeviceType=0x0, DeviceId=0x0
    1:  23 @ 64, type=0x1
    2:  36 @ 120, type=0xffff
    3:  21 @ 176, type=0x701
    4:  34 @ 232, type=0xf8ff
    Top level command (? for help):
 Logo Valid HTML 4.01 Strict