我有一个外置硬盘,肯定会出现故障(4 年多了)。我在读/写时不断遇到 I/O 错误,但在更换它之前,我确实想尝试延长使用寿命。
我知道我可以用来fsck -c /dev/sdX
标记坏块,但这是否也会围绕这些块重新索引文件系统?在我的搜索中,我没有得到可靠的答案。
当我在未安装的驱动器上尝试 fsck -c 时,我收到了错误的超级块消息,因此我正在考虑重新格式化,但这在过去的 I/O 错误方面也没有帮助,我已经这样做了一些以前有过几次。
编辑:为了澄清起见,这是一个旧的 Verbatim 外部驱动器,SATA 驱动器位于一个带有电源适配器的 SATA 转 USB 外壳中。此时,它只是一个连接到 Raspberry Pi 上以供使用的玩具驱动器(我已将其他所有内容备份到 NAS 上)。
就问题而言,我的主要问题是:如果我有一个损坏的块,导致读取和写入数据失败(根据 dmesg 和 badblocks,是否可以将该块标记为“死”并使用下一个好块来读取/写给?
当尝试执行磁盘写入时(仅),坏块会被重新映射。当坏块被重新映射时,来自该块的数据被放置到另一个备用的好块中。根据坏块的数量,文件损坏仍然可能发生。
\n磁盘坏块的正确方法是:
\n注意:不要中止坏块扫描!
\n注意:不要对 SSD 进行坏块操作
\n注意:首先备份您的重要文件!
\n注意:这将需要几个小时
\n注意:您可能有待处理的硬盘故障
\n以 \xe2\x80\x9c 引导至 Ubuntu Live DVD/USB 尝试 Ubuntu\xe2\x80\x9d 模式。
\n在terminal
...
sudo fdisk -l
# 识别所有“Linux 文件系统”分区
sudo e2fsck -fcky /dev/sdXX
# 只读测试
或者
sudo e2fsck -fccky /dev/sdXX
# 无损读/写测试(推荐)
-k 很重要,因为它保存以前的坏块表,并将任何新的坏块添加到该表中。如果没有 -k,您将丢失所有先前的坏块信息。
\n-fccky 参数...
\n -f Force checking even if the file system seems clean.\n\n -c This option causes e2fsck to use badblocks(8) program to do\n a read-only scan of the device in order to find any bad blocks.\n If any bad blocks are found, they are added to the bad block\n inode to prevent them from being allocated to a file or direc\xe2\x80\x90\n tory. If this option is specified twice, then the bad block scan\n will be done using a non-destructive read-write test.\n\n -k When combined with the -c option, any existing bad blocks in the\n bad blocks list are preserved, and any new bad blocks found by\n running badblocks(8) will be added to the existing bad blocks\n list.\n\n -y Assume an answer of `yes' to all questions; allows e2fsck to be\n used non-interactively. This option may not be specified at the\n same time as the -n or -p options.\n
Run Code Online (Sandbox Code Playgroud)\n
归档时间: |
|
查看次数: |
7152 次 |
最近记录: |