I had a power outage that left my RPi behaving strangely - hanging after specific set of command and similar. I have removed the SD card, plugged it via SD card reader to my computer, mounted and tried copying the files from it. Most of the files get copied without problem, but some of them only get copied up to a point (always the same), after which I get I/O errors. This renders SD card unusable - any subsequent reading of the SD card results in I/O errors, even for other files. Remounting SD cards makes it readable again, but any attempt to read the broken files makes it unusable again. Reading other files seems to work reliably.
Copying the whole partition with dd
has similar effects - I get I/O error after which system no longer finds /dev/sdd
.
e2fsck
finds nothing:
# e2fsck -f /dev/sdd2
e2fsck 1.42.13 (17-May-2015)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
rootfs: 50998/916864 files (0.6% non-contiguous), 2383924/3769856 blocks
My questions are:
- how can I save the broken files?
- how can I "mark" the broken sectors so that system avoids them?
- should I throw away the SD card, or is this just data error that can be fixed?
Thank you in advance.
P.S.: the data is not crucial (I do have backups, just not completely recent), but still... :)
EDIT: running e2fsck -c
doesn't help much because the card disappears after first error:
# e2fsck -c /dev/sdd2
e2fsck 1.42.13 (17-May-2015)
e2fsck: No such file or directory while trying to open /dev/sdd2
Possibly non-existent device?
root@A6:/opt/backup/rpi.crash/trade1# e2fsck -c /dev/sdd2
e2fsck 1.42.13 (17-May-2015)
Checking for bad blocks (read-only test): done
rootfs: Updating bad block inode.
Pass 1: Checking inodes, blocks, and sizes
Group 14's block bitmap (458752) is bad. Relocate<y>? no
Group 15's block bitmap (458753) is bad. Relocate<y>? no
Group 14's inode bitmap (458754) is bad. Relocate<y>? no
Group 15's inode bitmap (458755) is bad. Relocate<y>? no
Group 16's block bitmap (524288) is bad. Relocate<y>? ^C
rootfs: e2fsck canceled.
rootfs: ***** FILE SYSTEM WAS MODIFIED *****
rootfs: ********** WARNING: Filesystem still has errors **********
# e2fsck -c /dev/sdd2
e2fsck 1.42.13 (17-May-2015)
e2fsck: No such file or directory while trying to open /dev/sdd2
Possibly non-existent device?
#
EDIT2: my main problem is that I can't touch some of the sectors, because SD card disappears when I do (and I must plug SD card reader to another USB port so I can work with it again). Kingston 16 GB class 10 if it matters, 6 months old (10y warranty, no receipt).