so, I have a 8GB SDHC from CnMemory. I used it for my Raspberry Pi. It worked so far. But then my raspberry froze (can't connect via ssh, apache didnt respond either). So I pulled the power out. I rebootet the raspberry. This time with my monitor. FS seemed corrupt. I did fsck and resolved the issues. Reboot with shutdown -r
. Now it wouldn't start at all. Ok, so i thought I need to put up a blank new image to it.
I can't. GParted tells me that the card only has 1GB instead of 8GB.
# fsck /dev/mmcblk0
fsck from util-linux 2.20.1
e2fsck 1.42.8 (20-Jun-2013)
ext2fs_open2: Bad magic number in super-block
fsck.ext2: Superblock invalid, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/mmcblk0
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
fdisk and fdisk /dev/mmcblk0 result in the following
# fdisk
[...]
Disk /dev/mmcblk0: 1073 MB, 1073741824 bytes
4 heads, 16 sectors/track, 32768 cylinders, total 2097152 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
Disk identifier: 0x00000000
Disk /dev/mmcblk0 doesn't contain a valid partition table
# fdisk /dev/mmcblk0
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xccf88a5e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): w
The partition table has been altered!
And there it freezes. It says it has been altered but it doesn't it's stuck right there.
A Windowssystem can't format the SDCard either getting a I/O-Error.
It is the second SD Card with this problem!
I hope you have any idea how to solve this. Thanks!
Edit:
dd freezes as well when I try to wipe the partitiontable.
# dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=1
Edit2:
dmesg shows invalid allocation unit size
If I try to write with mkfs there are some errors.
# mkfs /dev/mmcblk0 --type=ext4
mke2fs 1.42.8 (20-Jun-2013)
Warning: could not erase sector 2: Attempt to write block to filesystem resulted in short write
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Warning: could not read block 0: Attempt to read block from filesystem resulted in short read
Warning: could not erase sector 0: Attempt to write block to filesystem resulted in short write
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: 0/8
Warning, had trouble writing out superblocks.
# dmesg
mmc0: SD Status: Invalid Allocation Unit Size
[...]
Did I completely break it after just a few hours?
I had a similar problem since I was not able to reformat the complete SD space after it has been coruppted by the RPI. Experimenting with the GPARTED Live system was not successful.
Finally I found a solution for deleting the partition using the command line tool
diskpart
on windows.
It is very easy and straight forward to use. I followed the instructions on
this short tutorial. Afterwards I was able to reformat it.
Unfortunateley, I couldn't find an equivalent solution for unix systems yet.
I was having an issue like this.
This was my output,
root@tygra:/path# dd bs=4M if=Gingerbread+EthernetManager.img of=/dev/mmcblk0
dd: failed to open ‘/dev/mmcblk0’: Read-only file system
I was using a microSD with an SD card adapter.
The solution was very simple. There's a tiny switch on the side of the adapter, turn it to un locked.
In my experience, the micro sd cards can stop functioning easily. I've had it now twice already, with different sd card brands, that writing to the sd stops to function and you're left with a broken filesystem and can't do much anymore. Sometimes you can save the data by copying it over from another device, read-only mounting the card.
My assumption would be that sd cards aren't particularly good as OS/swap discs, because writing has limits in total counts and granularity I believe. Still, servers are nowadays equipped with ssd's---but these might be heavily cached inside.
I've had something similar happen to my Raspberry Pi. What got it working for me was the SD Card Formatter from SD Association (https://www.sdcard.org/downloads/formatter_4/) which is available for both Mac and Windows, although it took a rather long time for my 4GB card.
Firs, download install and run the application. Insert the SD card and select the drive letter and then press format. Wait until it reaches 100%.
If it reports an incorrect capacity, try EaseUS Partition Master (http://www.partition-tool.com/) (it bundles some other software too, so be sure to un-tick/deselect them when installing). If you see any unpartitioned space, then that might be it.
I'm sorry if I can't recommend any tools that work with Linux, I tried it too on Linux but nothing seemed to work for me.
The answers here might work for you too: https://raspberrypi.stackexchange.com/questions/1446/how-can-i-reformat-my-sd-card-to-use-it-normally-again
or this:
Start a CMD prompt as administrator and follow these steps. Every line is a new command.
diskpart
list disk
select disk {{disk_number}} //Select the disk you would like to remove the partition from
list part
select part {{partition_number}} //Select the partition you would like to remove from the selected disk
delete part //Make sure you remove the correct partition!
create part pri
exit
User contributions licensed under CC BY-SA 3.0