6

I was trying to move the Pidora (Fedora for Raspberry Pi) image to my sd card using the dd command, but I realized that I had forgot to put in the bs=4M argument and had to terminate the program half way. After I tried to copy again with the right command, I saw that the SD card led won't flash and the computer won't write anything to the sd card, just as the sd card was corrupted. So I terminated the command again and tried to format it with fdisk. But with no success. Everything that was trying to access the sd card was freezing.

I tried to fix it with testdisk, but every time it tries to read/write something from the card, it returns read error.

I tried to write 0 to the sector 0 of the card, but it won't work:

[0x4d@nathalia ~]$ sudo dd if=/dev/zero count=1 of=/dev/mmcblk0
dd: writing to ‘/dev/mmcblk0’: Input/output error
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.00558315 s, 0.0 kB/s 

However, writing to the second partition of the card works:

[0x4d@nathalia ~]$ sudo dd if=/dev/zero count=10 of=/dev/mmcblk0p2
10+0 records in
10+0 records out
5120 bytes (5.1 kB) copied, 0.00309397 s, 1.7 MB/s

Is there anyway I can somehow repair the sd card? The information on it is not important. I just need it to work again.

Thanks.

7
  • Specifying the block size is purely optional, by the way.
    – Daniel B
    Commented Mar 20, 2014 at 8:07
  • @DanielB I know, but I have found out that the copying speed is very slow of you don't provide it. Is that right? Commented Mar 20, 2014 at 8:17
  • Yes, SD cards have a relatively large "erase block size". Every write that is smaller results in the block being read and written as a whole. Quite similar to a regular hard disk's sectors.
    – Daniel B
    Commented Mar 20, 2014 at 9:07
  • 1
    try a full format of the card, remove the partitions, then format it
    – nwgat
    Commented Mar 20, 2014 at 22:53
  • 2
    It might be hardware - the card broke down because the copy was too intense. Try a card of better quality, or newer. SD cards are fragile.
    – harrymc
    Commented Mar 22, 2014 at 15:30

1 Answer 1

1
  1. Use the "Disk Utility" program provided with the OS. Or use Gparted

  2. Delete all the partitions in it. Create a single new partition.

Hopefully your problem will be resolved. All the best

3
  • My card is just not be visible anymore in Gparted. I'm f*k. dd is more dangerous that I thought. Even format_sd fails.. ./format_sd -l Untitled /dev/sdc SD Card Formatter version 1.0.2 (build 3022.9.15.2d) Developed by Tuxera Inc. [ERROR] Failed to open '/dev/sdc' with flags 0x0: 123 (No medium found) [ERROR] Failed to open fat_device: 123 (No medium found) Commented Sep 16, 2023 at 1:08
  • Something which has worked for me in some cases, is putting the card on a windows machine and see if itgets detected there. And if it does get detected, I format it on Windows and then bring it back to a Linux machine. Hopefully you haven't lost your card yet.
    – rajudev
    Commented Oct 15, 2023 at 7:13
  • 1
    Instead of trying to mount the SD card with this USB dongle thingy. I bought a decent SD card reader from Lexar. Connected it to another Linux machine with USB a 3.0 port. And voila! Device was found again (luckily). I could format the card and try again using higher quality SD-card reader from the brand Lexar. This time dd worked out just fine. Lessons learned: Buy higher quality readers AND use USB 3.0 AND avoid SD card adapters. Commented Oct 16, 2023 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .