chs*_*chs 8 storage sd-card fdisk
由于我的 SD 卡上的文件系统损坏(可能是由于电源不足),我想创建一个新的文件系统。(e2fsck失败,在下面记录。)
但是,SD 卡上任何与文件相关的更改都会被神奇地撤销!
fdisk,旧的分区表会立即恢复原状。(在下面记录。)dd if=/dev/zero of=/dev/mmcblk0 bs=1M,fdisk合理地说Disk /dev/mmcblk0 doesn't contain a valid partition table。如果dd是这样做,以前的分区表又回来了。我没有用小开关物理锁定 SD 卡。我没有收到任何只读错误。事实上,我根本没有收到任何错误!dmesg除了我正在安装一个有错误的文件系统外,什么都不报告。
运行Xubuntu live cd(12.10)时也会出现问题。不幸的是,我目前无法访问其他计算机和/或 SD 卡读卡器。
这是我的电脑、我的 SD 卡的问题,还是我总是遗漏一些东西?有什么建议我可以尝试吗?
e2fsck 失败:
$ sudo e2fsck /dev/mmcblk0p2
e2fsck 1.42.5 (29-Jul-2012)
/dev/mmcblk0p2: recovering journal
Superblock needs_recovery flag is clear, but journal has data.
Run journal anyway<y>? yes
e2fsck: unable to set superblock flags on /dev/mmcblk0p2
/dev/mmcblk0p2: ********** WARNING: Filesystem still has errors **********
Run Code Online (Sandbox Code Playgroud)
这是显示fdisk无效的日志:
$ sudo fdisk /dev/mmcblk0
Command (m for help): p
Disk /dev/mmcblk0: 31.5 GB, 31460425728 bytes
4 heads, 16 sectors/track, 960096 cylinders, total 61446144 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: 0x00017b69
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 61446143 30661632 83 Linux
Command (m for help): d
Partition number (1-4): 1
Command (m for help): d
Selected partition 2
Command (m for help): p
Disk /dev/mmcblk0: 31.5 GB, 31460425728 bytes
4 heads, 16 sectors/track, 960096 cylinders, total 61446144 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: 0x00017b69
Device Boot Start End Blocks Id System
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 31.5 GB, 31460425728 bytes
4 heads, 16 sectors/track, 960096 cylinders, total 61446144 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: 0x00017b69
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 61446143 30661632 83 Linux
Run Code Online (Sandbox Code Playgroud)
在这一点上,我建议在 SD 卡上运行 badblocks 以查看它发现了什么。
听起来卡的写入逻辑已损坏,您在挂载点上看到的只是数据的缓存版本。它应该通过同步和卸载期间写回。看到您根本没有提到 SD 卡挂起表明损坏严重到足以产生误报写回响应,或者更简单地说,您的磁盘在说写入完成时对您撒谎。
您可以尝试在将卡从系统中取出时切换写保护开关。例如
努力刺激可能缓存“卡在 1”值的电路。除此之外,粉碎它,这样其他人就不会再遭受更多的悲伤并扔掉它。