There at too many report of SD card damaged when active on a sudden power loss. Without a orderly shutdown, you have a very high probability of data loss. (1) Just search for 'damaged SD'; some empiric reports go as high as 5% of the time!!
There is no single recipe to fix this problem and what area may be damaged is unpredictable.
You may save most data and perhaps, recover the full system, following one or more of the following steps.
- Setup a system on new SD card using the same procedure you use with the original you want to recover.
- Get a USB SD card reader (Amazon, eBay or you favorite one). There is a SD card sold with a free SD to USB adapter.
- Mount the card on the reader and plug on the RPi USB hub.
- Using
ls /dev/sd*
find the damaged SD card just mounted, it will show as /dev/sda
or perhaps /dev/sdb
.
ls /dev/sd
0 brw-rw---- 1 root disk 8, 0 2016-06-20 22:02 /dev/sda
0 brw-rw---- 1 root disk 8, 1 2016-06-20 22:02 /dev/sda1
0 brw-rw---- 1 root disk 8, 2 2016-06-20 22:02 /dev/sda2
If your are using 'Jessie' the memory will be automatically mounted. Check with df
; if this is the case you may not need the next few steps.
Explore the SD finding which partitions are ok and which one are damaged.
using fdisk /dev/sda1'
fdisk -l /dev/sda
Disk /dev/sda: 28.8 GiB, 30908350464 bytes, 60367872 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6f92008e
Device Boot Start End Sectors Size Id Type
/dev/sda1 8192 131071 122880 60M c W95 FAT32 (LBA)
/dev/sda2 131072 2658303 2527232 1.2G 83 Linux
The configuration will be different if you started with NOOBS.
If you reach this point and no hard sector failure you are in good shape to continue.
In this case you have two partitions, /dev/sda1
, type FAT32, the boot partition and /dev/sda2
type Linux. (yours may be different)
- To mount the first one, create an empty directory and mount the partition:
mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1
Check the content with ls /mnt/sda1
and compare the listing with your (new) running unit: should be the same content than ls /boot
. If not the case, just copy the missing files.
If you have data to recover, mount the 'linux' partition, replacing 'sda1' by 'sdb2' and follow the previous mount procedure. Then, you can scout and recover your old files copying them to your running system.
About the blinks: the green light also blinks when the SD card is active. Default green led use is [mmc0]:
cat /sys/class/leds/led0/trigger
none [mmc0] timer oneshot heartbeat backlight gpio cpu0 cpu1 cpu2 cpu3 default-on input rfkill0 phy0rx phy0tx phy0assoc phy0radio
Boot blinks and other useful info are described here, but some information is deprecated.
pd: sudo
omitted for brevity.