Rescuing my dead microSD card

So unfortunately my A1 mSD card died and I’m pissed. Its a 128GB.

Symptoms: Card is readable momentarily, but files cannot be moved. What files that are moved are only partially there, or if lucky, 2 or 3 things are copied over, along with the folder structure. But if you keep remounting it you can keep pulling data off of it.

How to fix: DDRescue.

DDRescue allows you to DD a mount point into an image file and if the device is skipping like mine, no problem, it just remounts and immediately goes back to the memory address it was polling.

While overkill, heres what I did, and what it looks like.

[dommer@d4rk and-sd]$ sudo ddrescue -d -r300 /dev/sdd recovery.img recovery.logfile
GNU ddrescue 1.25
Press Ctrl-C to interrupt
     ipos:   61286 MB, non-trimmed:        0 B,  current rate:       0 B/s
     opos:   61286 MB, non-scraped:        0 B,  average rate:  12698 kB/s
non-tried:        0 B,  bad-sector:    30720 B,    error rate:   5473 kB/s
  rescued:  127865 MB,   bad areas:        1,        run time:  2h 47m 48s
pct rescued:   99.99%, read errors:   671775,  remaining time:         n/a
                              time since last successful read:          1s
Finished                       

D tells the program to use direct disk access and ignore the cache in kernel

r300 tells the program to retry up to 300 times

and it dumps to an img I can shoot back into another SD card. I even get a handy dandy log file to read. This is what was in it:



# Mapfile. Created by GNU ddrescue version 1.25
# Command line: ddrescue -d -r300 /dev/sdd recovery.img recovery.logfile
# Start time:   2020-06-15 04:32:43
# Current time: 2020-06-15 07:20:31
# Finished
# current_pos  current_status  current_pass
0xE44F08A00     +               300
#      pos        size  status
0x00000000  0xE44F08800  +
0xE44F08800  0x00007800  -
0xE44F10000  0xF806F0000  +

Only thing is I wish I could open the img file but engrampa doesn’t seem to want to. Maybe another program would, but honestly ATP I just have to hope all my data is there as I need a new SD card anyways. I think the one I have is completely fried, which really pisses me off. I don’t want to buy another dumbass shitty storage medium that’ll just die in another 2 years.

So I ask yall, now after a small tutorial and rant, whats a good SD card thats like 128-256GB that won’t die from a flipped bit?

Alternatively, is there any way I can fix my skipping SD card that I currently have?

Ended up going with this one.

Cheapest of all of them and nothing more than what I need. Just for downloading and holding music, podcasts, or pictures. Hopefully this one lasts. The 128GB one I bought was like 60 bucks a couple years ago, so that one pisses me off hardcore.

Just as an extra experiment I’m attempting to bitsmash my way past the bad sector of the SD card I have using DDRescue. I’m having it write /dev/zero to the microsd card with 300 reattempts just to see if it with format it completely and force the controller to reset. This sometimes works on USB sticks with just DD but I want to try DDRescue since it leaves a readout.

sudo ddrescue -r300 --force /dev/zero /dev/sdf

If the SDCard blows up while doing this, big woop. If it works, woohoo. Either way theres a replacement on the way I just want to get my data out of the .img at this point.

Never mind I’m retarded I didn’t realize you can just mount img files. I’ve been on windows too long guys holy shit.

1 Like

Not only can you mount an image, but you can use offsets to mount partitions within image files… If you can’t do it in Linux, it’s likely you can’t do it :stuck_out_tongue:

1 Like

I’m guessing this is performance heavy on the SD card? How hot is the card running after using this tweak?

I did the image dump as a last ditch effort having given up after I attempted other methods. The card gets warm, mut not hot. I wouldn’t not dump like this more than 2 times a day if you wanna keep .our card.

Blkid shows my SD card as sda1 and UUID but not PARTUUID. When I invoke ddrescue -d /dev/sda1 recovery.img recovery.logfile,
it returns “command not found”. My system claims ddrescue is installed and the newest version is 1.23.1. I have Buster debian10 installed on this corrupted SD card and gparted displays no file system and no volume. Anyone have any useful ideas?

I’ve installed with gddrescue cmd. So how do you mount the image file to read the contents and extract my files?

If you just ddrescue’d the one partition, all you need to do is

fsck recovery.img
mount -o loop recovery.img /mnt/

Can’t perform a rescue. Gparted shows the SD card @512mb when it’s really 16 GB. File system is “unallocated”.

When I load the SD card into rpi4, the splash screen says Can’t read partition as fat32. So I need to convert the partition to fat32 without formatting it. How can that be accomplished? Ddrescue doesn’t seem to be the correct procedure for this hang up or is it?

There are other data on the splash screen; i.e. bootloader and such. I will attempt to include as much of that data in a subsequent post.

ddrescue is a low level tool. It just copies the bits directly to an image. You need to run other utilities such as testdisk and/or photorec on copies of the image to find any recoverable data.

Disk capacity must be correctly detected before recovery can occur. Testdisk and Photorec both detect the incorrect capacity for the sd drive. I thought maybe Diskpart>select volume>recover might work or use the program to convert the card to fat32.

This the output from dmesg |tail
795.034541] scsi host0: usb-storage 1-1.3:1.0
[ 796.096962] scsi 0:0:0:0: Direct-Access Multi Flash Reader 1.00 PQ: 0 ANSI: 0
[ 796.097847] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 796.315592] sd 0:0:0:0: [sda] 1024 512-byte logical blocks: (524 kB/512 KiB)
[ 796.318805] sd 0:0:0:0: [sda] Write Protect is off
[ 796.318832] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[ 796.320251] sd 0:0:0:0: [sda] No Caching mode page found
[ 796.320268] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 796.425941] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 1216.574849] v3d fec00000.v3d: MMU error from client L2T (0) at 0x2e41000, pte invalid

Gparted says partition and filesystem are unallocated.

DISKPART indicates the filesystem as RAW. Need a method to convert it Fat without losing data. That’s why testdisk and ddrescue are useless. Anyone have some ideas?

Testdisk and photorec will work on RAW disks/partitions just fine, as will other data recovery tools. You can’t “convert” a partition.

But you can convert a file system? That’s all I wanna do.

Testdisk wont function if it detects the drive as less than the correct size.

If you just need to enlarge the image, that’s quick and easy.

dd if=/dev/zero of=recovery.img bs=1G seek=128 count=0

When trying to mount the rescued partition, I get WARNING:device write-protected. read-only

I try a different card reader and run ddrescue. When I try to mount the .img file, this is the output. mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop1, missing codepage or helper program, or other error.