7

Is there any chance to recover some files that are on a SD card which doesn't boot anymore? Seems the last power-cut affected some files on the card and the Raspberry Pi is not able to boot anymore.

14

First, why it doesn't boot? What do the lights show? Debug it with this wiki

The problem might be in the FAT partition, that can be easily recovered by reformating and put back the files (Using either your image or one downloaded from the web.)

If it's the Linux filesystem, loading it on a Linux (even a liveCD) and running fsck might be enough to recover it.

So attach the SD card, open a console and do dmesg to view the label of the last disk (example sdb) discovered, do fdisk -l /dev/sdb to see what partitions exist. The Linux one should be called Linux (example sdb2). finally do fsck /dev/sdb2 to scan and fix the filesystem.

If all fails, maybe the SD has gone bad, I would do a dd if=/dev/sdb of=file.img (of even better dd_rescue /dev/sdb file.img if you have dd_rescue installed) to backup the SD to a file and trying to recover things from there, by transforming the image on a device with losetup --find --show file.img work on it.

  • Thanks man, at least I was able to recover some of my code by fsck command. – Priyank Bolia Sep 2 '13 at 13:40
4

If the filesystem isn't corrupted badly, it's possible to mount it on another system and copy the files off.

On another Linux system, type sudo mount -o ro /dev/mmcblk0p2 /mnt into a terminal. This mounts the SD card (assuming it's at mmcblk0) read-only at /mnt.

From there you can browse into the directory structure with a file manager and copy any needed files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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