I've been googling at this all night and have found multiple conflicting methods of recovering/formatting/saving corrupt SD cards but i'm a complete n00b with both Raspberry Pi and Linux.

Basically my son was playing games in retropie and accidentally yanked out the power cable and corrupted the SD card. I don't mind replacing the SD card, i don't mind reinstalling retropie and setting the whole thing up again. The only thing that is annoying me is that i've spent quite a few months playing FFVII with my daughter and we're on disk 3 trying to 100% everything as i did once upon a time. I'd very much like to retrieve the SRM save file so we can continue. Yes should have backed up etc. I know....

My understanding so far is that the best way to attempt this is from terminal commands in Linux so i've created a bootable Linux USB and i can run this on my Macbook (it has an SD card slot, my PC does not). I'll try and type up as much of what i've done so far to help outline where i am with this.

When i put the SD card in, nothing happens (when i put in a known good SD card, it pops up on the desktop right away). I know mine is corrupt and i don't expect it to work as the known good one does but i'm hoping that somehow there is a way to get a single file off it if possible.

When i run sudo fdisk -l with the known good card in, it shows up as /dev/sdc (/sda is my internal SSD, /sdb is my memory stick with ubuntu) so i'm assuming the bad card with be sdc also.

I've seen people on forums tell people to use dmesg to look for something but i'm not sure what i'm supposed to be looking for and they weren't clear. Is this relevant:

[    8.001985] scsi 0:0:0:0: Direct-Access     APPLE    SD Card Reader   3.00 PQ: 0 ANSI: 6
[    8.002209] sd 0:0:0:0: Attached scsi generic sg1 type 0
[    8.128452] scsi 2:0:0:0: Direct-Access     TDK LoR  TF10             1.00 PQ: 0 ANSI: 2
[    8.128696] sd 2:0:0:0: Attached scsi generic sg2 type 0
[    8.128892] sd 2:0:0:0: [sdc] 15669248 512-byte logical blocks: (8.02 GB/7.47 GiB)
[    8.129087] sd 2:0:0:0: [sdc] Write Protect is off
[    8.129089] sd 2:0:0:0: [sdc] Mode Sense: 03 00 00 00
[    8.129288] sd 2:0:0:0: [sdc] No Caching mode page found
[    8.129290] sd 2:0:0:0: [sdc] Assuming drive cache: write through
[    8.131211]  sdc: sdc1 sdc2
[    8.132065] sd 2:0:0:0: [sdc] Attached SCSI removable disk

Can somebody please guide me on what to do next in my attempt to read data from the SD card? How to first test if it is even possible then what to do next etc. I'd greatly appreciate it!

1 Answer 1


We should try to do typical disaster recovery. This isn't an easy task but I started this answer with suggestions that I think it is best to start with. With your comments we will improve the answer step by step hopefully to a solution.

You are on Ubuntu. That's good. And as you show from the kernel messages (dmesg) the kernel knows the SD Card as device /dev/sdc. That's also very good. First we will make a working image and don't touch the SD Card after this anymore. So we can work on the image with try an error and if we destroy it we can start from the beginning.

To take a working image we use dd. There is also a rescue version of dd for forensic tasks but first we use the normal one. That will give us an idea how corrupt the SD Card is. Execute this command with the SD Card inserted:

ubuntu ~$ sudo dd if=/dev/sdc of=rescue.img
ubuntu ~$ sudo chown user:user rescue.img  #take the user name you are logged in

This can take a long time depending on the capacity of your SD Card and its read performance. Times of 10 minutes or longer are possible. When it has finished with an error message about reaching the end of the SD Card pull it out and take it away. Then we archive the image so we have it by hand if we corrupt our working copy.

ubuntu ~$ gzip --keep rescue.img

This will create a compressed copy that you can restore with gzip --keep --decompress rescue.img.gz. Now you can try to mount the partitions in the image. I'm not familiar with Retropie so I don't know what partitions it has. For example I will use Raspbian Stretch Lite 2018-06-27. Look what partitions in the image with:

ubuntu ~$ sudo parted rescue.img unit s print
Model:  (file)
Disk /home/ingo/rescue.img: 3637248s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End       Size      Type     File system  Flags
 1      8192s   96663s    88472s    primary  fat32        lba
 2      98304s  3637247s  3538944s  primary  ext4
ubuntu ~$

Here we see what partitions exist. Now we will mount them. For this we need the Start and Size:

ubuntu ~$ mkdir sdc1/
ubuntu ~$ mkdir sdc2/
ubuntu ~$ sudo mount -o loop,offset=$((8192*512)),sizelimit=$((88472*512)) rescue.img sdc1/
ubuntu ~$ sudo mount -o loop,offset=$((98304*512)),sizelimit=$((3538944*512)) rescue.img sdc2/

You should find the right numbers from the example. If this works you can access the file systems on the image and search for your file for example:

ubuntu ~$ sudo ls sdc1/
ubuntu ~$ sudo cp sdc2/home/pi/myfile.srm . #last character is a dot
  • This is great, thanks for your help but unfortunately i'm not getting past the first command. I'm getting dd: failed to open '/dev/sdc': No medium found when i try to run it. I'm guessing this probably means the SD card is toast? Aug 23, 2018 at 15:39
  • @Crickentine Do you see the messages for [sdc] with dmesg? These messages definitely say that the kernel sees a medium with two partitions sdc: sdc1 sdc2 and that it is Attached SCSI removable disk and can be written to (the other messages). I'm a little bit helpless why you don't see the device. Maybe it has changed to /dev/sdd? Please edit your question and add the output of these two commands: sudo parted -l and lsblk when the SD Card is attached.
    – Ingo
    Aug 23, 2018 at 22:53
  • I'll get on this as soon as i get a chance. Could there be a possibility that dmesg thought the known good card was still inserted? I definitely ran dmesg with the bad card in but had the good card in right before and ran it then too. Aug 24, 2018 at 18:36
  • @Crickentine Seems I have something overseen or it's unclear. I have thought the messages from dmesg you shows in your question are from the corrupted card. Is it? If not what do you get in dmesg when it is attached?
    – Ingo
    Aug 24, 2018 at 20:26
  • The dmesg i posted was from the corrupt card but I had the good one in just before and done dmesg with it to try and see what the difference was. I haven't had a chance to get back to it yet, hopefully will get time this evening to I'll report back then. Aug 25, 2018 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.