linux - 如何检查 ubifs 文件系统?

标签 linux fsck ubifs

ubifs 没有fsck 程序,那么使用ubifs 时如何检查文件系统的完整性?

我的目标系统是ARM,Linux 3.2.58。

最佳答案

根据我目前在 UBIFS' web page 上的发现:

integrity - UBIFS (as well as UBI) checksums everything it writes to the flash media to guarantee data integrity, UBIFS does not leave data or meta-data corruptions unnoticed (JFFS2 is doing the same); By default, UBIFS checks only meta-data CRC when it reads from the media, but not the data CRC; however, you may force CRC checking for data using one of the UBIFS mount options - see here.

如果您需要检查文件系统是否损坏

如果您的 UBIFS 文件系统是使用 chk_data_crc 选项挂载的,那么简单的 cat $FILES >/dev/null 就足够了。如果不是,您只能检测和恢复元数据损坏。文件主体的损坏将被忽视。

我使用了类似find/-type f -print -exec cat {} + >/dev/null

如果您需要恢复损坏的文件

再次来自overview部分:

to make it more clear, imaging you have wiped out the FAT table on your FAT file system; for FAT FS this would be fatal; but if you similarly wipe out UBIFS index, you still may re-construct it, although a special user-space tool would be required to do this (this utility is not implemented at the moment, though)

虽然理论上可行,但您只能靠自己。

备份闪存内容,用 UBIFS 数据结构(可能是源代码)和十六进制编辑器武装自己,祝你好运。

编辑:正如我所想,Linux 的 MTD 驱动程序已经将 ECC(纠错码)应用于 MTD 设备。

我相信,如果每个 /sys/class/mtd/mtd*/有超过 /sys/class/mtd/mtd*/ecc_strength 错误,则数据丢失的标准ecc_step_size 闪存 block 。 mtd_read()(它是比 UBIFS 低一级的 MTD API)will return EUCLEAN在这种情况下。不知道有没有工具可以用它来检查错误。

The "bit flipped" warnings we get do not mean that there was a data loss yet .您可以写入 /sys/class/mtd/mtd*/bitflip_threshold 来控制收到的警告数量。

关于linux - 如何检查 ubifs 文件系统?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32960034/

相关文章:

c - Linux登录和strcmp

linux - 删除早于 X 天的目录

hadoop - HBase 集群在 HDFS 上有损坏的区域文件

hadoop - 如何从 Hadoop 中的一个特定机架获取 block 报告?

linux - 如何为 SSD 闪存驱动器安装 UBIFS 文件系统?

linux-kernel - ubifs 卷与 mtd 分区

linux - 将 UBIFS 分区复制到 NAND 设备

c - cd插入C时发出信号

linux - 如何在 Linux PHP 应用服务上全局安装 Composer?