Raspberry Pi 的 SD 卡坏了?无法格式化

Raspberry Pi 的 SD 卡坏了?无法格式化

我有一块来自 CnMemory 的 8GB SDHC。我把它用于我的 Raspberry Pi。到目前为止,它工作正常。但后来我的树莓派死机了(无法通过 ssh 连接,apache 也没有响应)。所以我拔掉了电源。我重启了树莓派。这次用的是显示器。FS 似乎损坏了。我执行了 fsck 并解决了问题。用 重启shutdown -r。现在它根本无法启动。好的,所以我想我需要给它放一个空白的新图像。

我不能。GParted 告诉我该卡只有 1GB,而不是 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 和 fdisk /dev/mmcblk0 产生以下结果

# 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!

然后它就卡住了。它显示它已被更改,但事实并非如此,它就卡在那里。

Windows 系统无法格式化 SDCard,并且出现 I/O 错误。

它是第二SD卡有这个问题!

希望您知道如何解决这个问题。谢谢!


编辑:

当我尝试擦除分区表时,dd 也会冻结。

# dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=1

编辑2:

dmesg 显示invalid allocation unit size

如果我尝试使用 mkfs 写入,会出现一些错误。

# 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
[...]

我只用了几个小时就把它彻底弄坏了吗?

答案1

你的两张 SD 卡都是 CnMemory 的吗?

看起来卡本身已经坏了,在相机中使用几个月后似乎出现很多故障......

还有以下命令

sudo fsck /dev/mmcblk0

是错误的,没有超级块并不奇怪,因为你把它指向了错误的东西...mmcblk0 是磁盘,mmcblk0p2 是 ext4 分区(如果你使用的是图像)或 mmcblk0p6(如果使用安装了单个操作系统的 NOOBS)

答案2

我以前也遇到过这种情况。我刚刚重新格式化,但在重新格式化之前我删除了卡上的所有文件,这可能导致文件受到保护。

相关内容