我有一个10岁的320 Gb硬盘,我用它作为外部驱动器,它和我一起旅行了很长一段时间。不用说,它挺过了几次跌落(包括在运营中的跌落),并出现了一些糟糕的板块。实际上,当我开始获取读取错误,而不仅仅是智能扇区重新定位警告时,我移除了其中的所有重要内容(对某些文件使用ddrescue )。当然,我不能再信任这个驱动器了,但我仍然想要使用它复制一次并保存一些电影/ SSD+HDD,以便在笔记本电脑的上释放一些空间,只要外部驱动器仍然工作。我不在乎丢失一些或全部这些文件,因为我要么在家里备份,要么可以轻松地重新下载。
问题是,如果我格式化这个驱动器并开始复制那里的文件,在25%左右的某个地方我会出现写失败,需要拔出USB电缆插头(^C是不够的!),在读和写模式下badblocks也会发生同样的情况。在使用badblocks‘’"from“和"to”参数之后,我发现驱动器的90%+没有问题,基本上有3个不好的块区域。一个简短的脚本和我得到了一个文本文件,其中包含了块号(是的,我没有忘记-b 4096 for badblocks),它覆盖了这些区域,为了安全起见,还有很多额外的空间。但是当我做e2fsck -l badblocks.txt的时候,它仍然挂着!似乎它是试图读那些坏的街区无论如何,不只是标记为坏和忘记。还有别的办法可以绕过这件事吗?或者其他文件系统(考虑到FAT,但我没有看到任何方法将badblocks.txt喂给fsck.vfat)?还是覆盖“好”区域的4个单独分区是这种情况的最佳解决方案?
更新:一些来自man的引文使情况更加清楚
man e2fsck-i input_file Read a list of already existing known bad blocks. Badblocks will skip testing these blocks since they are known to be bad.
因此,badblocks承诺跳过列出的块(它确实跳过了,因为它不与badblocks.txt中的所有可疑范围挂起!)
man badblocks-l filename Add the block numbers listed in the file specified by filename to the list of bad blocks. The format of this file is the same as the one generated by the badblocks(8) program.
不过,没有人保证它不会尝试访问这些块。但是为什么它会想要访问它们呢?
`Note that the block numbers are based on the blocksize of the filesystem. Hence, badblocks(8) must be given the blocksize of the filesys‐ tem in order to obtain correct results. As a result, it is much simpler and safer to use the -c option to e2fsck, since it will assure that the correct parameters are passed to the badblocks program.`我会很高兴,但它挂在第一个坏街区。另外,-c与-l不兼容-因此,我要么扫描磁盘,要么手动标记坏扇区。但为什么,如果我选择后一种选择,它仍然想进入这些所谓的“坏”部门是我所无法理解的.
发布于 2019-03-21 15:05:28
sudo e2fsck -fck /dev/sdc1 #只读测试
或
sudo e2fsck -fcck /dev/sdc1 #无损读写测试(推荐)
-k很重要,因为它保存了以前的坏块表,并将任何新的坏块添加到该表中。如果没有-k,就会丢失以前所有的坏块信息。
-fcck参数..。
-f Force checking even if the file system seems clean.
-c This option causes e2fsck to use badblocks(8) program to do a
read-only scan of the device in order to find any bad blocks.
If any bad blocks are found, they are added to the bad block
inode to prevent them from being allocated to a file or direc‐
tory. If this option is specified twice, then the bad block
scan will be done using a non-destructive read-write test.
-k When combined with the -c option, any existing bad blocks in the
bad blocks list are preserved, and any new bad blocks found by
running badblocks(8) will be added to the existing bad blocks
list.https://askubuntu.com/questions/1127377
复制相似问题