12

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.

Ghanima
  • 15,855
  • 15
  • 61
  • 119
el.severo
  • 269
  • 2
  • 4
  • 13

2 Answers2

17

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.

James Taylor
  • 289
  • 1
  • 3
  • 13
higuita
  • 684
  • 5
  • 6
6

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.

nc4pk
  • 1,378
  • 1
  • 13
  • 25