由于在关键更新期间缺电,我的笔记本电脑硬盘出现了一些问题。
从那时起,我就可以重新启动,几乎没有任何进一步的问题,但最近,可能是由于另一次重大更新或硬盘出现问题(真的不知道......),我的机器无法仅通过硬盘启动(嗯,我实际上并没有尝试使用 Windows,但没有尝试过 Ubuntu,它基本上是我在其上使用的唯一操作系统),所以我不得不使用 Ubuntu USB 闪存盘来使其工作。
我按照许多在线教程操作,了解如何处理该问题,但最终安装smartmontools
失败,因为使用smartctl
某些在线资源查找重新分配的扇区没有给出任何结果。
我在按照另一个教程操作后运气更好,并且使用了sudo badblocks -sv -b 512 /dev/sdb
:经过长时间的扫描后,我摆脱了困境:
618997769one, 1:58:10 elapsed. (1/0/0 errors)
618997770one, 1:58:13 elapsed. (2/0/0 errors)
618997771one, 1:58:16 elapsed. (3/0/0 errors)
618997772one, 1:58:20 elapsed. (4/0/0 errors)
618997773one, 1:58:23 elapsed. (5/0/0 errors)
618997774one, 1:58:26 elapsed. (6/0/0 errors)
618997775one, 1:58:30 elapsed. (7/0/0 errors)
618997776one, 1:58:33 elapsed. (8/0/0 errors)
618997777one, 1:58:36 elapsed. (9/0/0 errors)
618997778one, 1:58:39 elapsed. (10/0/0 errors)
618997779one, 1:58:42 elapsed. (11/0/0 errors)
618997780one, 1:58:45 elapsed. (12/0/0 errors)
618997781one, 1:58:49 elapsed. (13/0/0 errors)
618997782one, 1:58:52 elapsed. (14/0/0 errors)
618997783one, 1:58:56 elapsed. (15/0/0 errors)
618997784one, 1:58:59 elapsed. (16/0/0 errors)
618997785one, 1:59:02 elapsed. (17/0/0 errors)
618997786one, 1:59:05 elapsed. (18/0/0 errors)
618997787one, 1:59:08 elapsed. (19/0/0 errors)
618997788one, 1:59:12 elapsed. (20/0/0 errors)
618997789one, 1:59:15 elapsed. (21/0/0 errors)
618997790one, 1:59:18 elapsed. (22/0/0 errors)
618997791one, 1:59:21 elapsed. (23/0/0 errors)
618997792one, 1:59:25 elapsed. (24/0/0 errors)
618997793one, 1:59:28 elapsed. (25/0/0 errors)
618997794one, 1:59:31 elapsed. (26/0/0 errors)
618997795one, 1:59:35 elapsed. (27/0/0 errors)
618997796one, 1:59:38 elapsed. (28/0/0 errors)
618997797one, 1:59:41 elapsed. (29/0/0 errors)
618997798one, 1:59:44 elapsed. (30/0/0 errors)
618997799one, 1:59:47 elapsed. (31/0/0 errors)
618997800one, 1:59:50 elapsed. (32/0/0 errors)
618997801one, 1:59:53 elapsed. (33/0/0 errors)
618997802one, 1:59:57 elapsed. (34/0/0 errors)
618997803one, 2:00:00 elapsed. (35/0/0 errors)
618997804one, 2:00:03 elapsed. (36/0/0 errors)
618997805one, 2:00:07 elapsed. (37/0/0 errors)
618997806one, 2:00:10 elapsed. (38/0/0 errors)
618997807one, 2:00:13 elapsed. (39/0/0 errors)
618997808one, 2:00:16 elapsed. (40/0/0 errors)
618997809one, 2:00:19 elapsed. (41/0/0 errors)
618997810one, 2:00:23 elapsed. (42/0/0 errors)
618997811one, 2:00:26 elapsed. (43/0/0 errors)
618997812one, 2:00:29 elapsed. (44/0/0 errors)
618997813one, 2:00:32 elapsed. (45/0/0 errors)
618997814one, 2:00:35 elapsed. (46/0/0 errors)
618997815one, 2:00:38 elapsed. (47/0/0 errors)
618997816one, 2:00:41 elapsed. (48/0/0 errors)
618997817one, 2:00:45 elapsed. (49/0/0 errors)
618997818one, 2:00:48 elapsed. (50/0/0 errors)
618997819one, 2:00:51 elapsed. (51/0/0 errors)
618997820one, 2:00:55 elapsed. (52/0/0 errors)
618997821one, 2:00:58 elapsed. (53/0/0 errors)
618997822one, 2:01:01 elapsed. (54/0/0 errors)
618997823one, 2:01:04 elapsed. (55/0/0 errors)
618997824one, 2:01:07 elapsed. (56/0/0 errors)
618997825one, 2:01:10 elapsed. (57/0/0 errors)
618997826one, 2:01:14 elapsed. (58/0/0 errors)
618997827one, 2:01:17 elapsed. (59/0/0 errors)
618997828one, 2:01:20 elapsed. (60/0/0 errors)
618997829one, 2:01:23 elapsed. (61/0/0 errors)
618997830one, 2:01:26 elapsed. (62/0/0 errors)
618997831one, 2:01:30 elapsed. (63/0/0 errors)
done
Pass completed, 64 bad blocks found. (64/0/0 errors)
这至少能让我了解我是否犯了错误,以及错误出在哪里。我仍然不知道为什么数字后面要跟“一”,所以请告诉我这部分内容。
此时,我尝试了我发现最有效的方法,即进行修复打击:
sudo hdparm --write-sector --yes-i-know-what-i-am-doing 618997831 /dev/sdb
遗憾的是,即使尝试使用一个或其他不同的版本,它只给我返回:
write-sector: bad/missing sector value
而我现在有点迷茫了:任何建议,越有教育意义/信息量越大越好,都将不胜感激。
提前感谢您的关注,如果我忘记了一些关键细节,请询问:)
编辑:哦,非常感谢@David!
这确实有帮助,但是现在sdb
似乎好的,我从 获得此信息sda
,仍在使用sudo badblocks -sv -b 512 /dev/sda
:
Checking blocks 0 to 625142447
Checking for bad blocks (read-only test): 0.00% done, 0:00 elapsed. (0/0/0 err545995272one, 1:26:12 elapsed. (0/0/0 errors)
545995273one, 1:26:15 elapsed. (1/0/0 errors)
545995274one, 1:26:18 elapsed. (2/0/0 errors)
545995275one, 1:26:21 elapsed. (3/0/0 errors)
545995276one, 1:26:25 elapsed. (4/0/0 errors)
545995277one, 1:26:28 elapsed. (5/0/0 errors)
545995278one, 1:26:31 elapsed. (6/0/0 errors)
545995279one, 1:26:35 elapsed. (7/0/0 errors)
545995280one, 1:26:39 elapsed. (8/0/0 errors)
545995281one, 1:26:43 elapsed. (9/0/0 errors)
545995282one, 1:26:47 elapsed. (10/0/0 errors)
545995283one, 1:26:55 elapsed. (11/0/0 errors)
545995284one, 1:27:00 elapsed. (12/0/0 errors)
545995285one, 1:27:06 elapsed. (13/0/0 errors)
545995286one, 1:27:11 elapsed. (14/0/0 errors)
545995287one, 1:27:17 elapsed. (15/0/0 errors)
545995288one, 1:27:21 elapsed. (16/0/0 errors)
545995289one, 1:27:25 elapsed. (17/0/0 errors)
545995290one, 1:27:29 elapsed. (18/0/0 errors)
545995291one, 1:27:35 elapsed. (19/0/0 errors)
545995292one, 1:27:39 elapsed. (20/0/0 errors)
545995293one, 1:27:46 elapsed. (21/0/0 errors)
545995294one, 1:27:49 elapsed. (22/0/0 errors)
545995295one, 1:27:53 elapsed. (23/0/0 errors)
545995296one, 1:27:56 elapsed. (24/0/0 errors)
545995297one, 1:27:59 elapsed. (25/0/0 errors)
545995298one, 1:28:02 elapsed. (26/0/0 errors)
545995299one, 1:28:06 elapsed. (27/0/0 errors)
545995300one, 1:28:09 elapsed. (28/0/0 errors)
545995301one, 1:28:12 elapsed. (29/0/0 errors)
545995302one, 1:28:16 elapsed. (30/0/0 errors)
545995303one, 1:28:19 elapsed. (31/0/0 errors)
545995304one, 1:28:22 elapsed. (32/0/0 errors)
545995305one, 1:28:28 elapsed. (33/0/0 errors)
545995306one, 1:28:31 elapsed. (34/0/0 errors)
545995312one, 1:28:38 elapsed. (35/0/0 errors)
545995313one, 1:28:42 elapsed. (36/0/0 errors)
545995320one, 1:28:49 elapsed. (37/0/0 errors)
545995328one, 1:28:58 elapsed. (38/0/0 errors)
545995329one, 1:29:02 elapsed. (39/0/0 errors)
545995336one, 1:29:06 elapsed. (40/0/0 errors)
545995337one, 1:29:10 elapsed. (41/0/0 errors)
545995338one, 1:29:13 elapsed. (42/0/0 errors)
618997768one, 1:45:58 elapsed. (43/0/0 errors)
618997769one, 1:46:02 elapsed. (44/0/0 errors)
618997770one, 1:46:05 elapsed. (45/0/0 errors)
618997771one, 1:46:08 elapsed. (46/0/0 errors)
618997772one, 1:46:11 elapsed. (47/0/0 errors)
618997773one, 1:46:14 elapsed. (48/0/0 errors)
618997774one, 1:46:18 elapsed. (49/0/0 errors)
618997775one, 1:46:21 elapsed. (50/0/0 errors)
618997792one, 1:46:24 elapsed. (51/0/0 errors)
618997793one, 1:46:28 elapsed. (52/0/0 errors)
618997794one, 1:46:31 elapsed. (53/0/0 errors)
618997795one, 1:46:34 elapsed. (54/0/0 errors)
618997796one, 1:46:38 elapsed. (55/0/0 errors)
618997797one, 1:46:41 elapsed. (56/0/0 errors)
618997798one, 1:46:44 elapsed. (57/0/0 errors)
618997799one, 1:46:48 elapsed. (58/0/0 errors)
618997808one, 1:46:51 elapsed. (59/0/0 errors)
618997809one, 1:46:55 elapsed. (60/0/0 errors)
618997810one, 1:46:58 elapsed. (61/0/0 errors)
618997811one, 1:47:01 elapsed. (62/0/0 errors)
618997812one, 1:47:05 elapsed. (63/0/0 errors)
618997813one, 1:47:08 elapsed. (64/0/0 errors)
618997814one, 1:47:11 elapsed. (65/0/0 errors)
618997815one, 1:47:14 elapsed. (66/0/0 errors)
618997816one, 1:47:18 elapsed. (67/0/0 errors)
618997817one, 1:47:21 elapsed. (68/0/0 errors)
618997818one, 1:47:24 elapsed. (69/0/0 errors)
618997819one, 1:47:27 elapsed. (70/0/0 errors)
618997820one, 1:47:30 elapsed. (71/0/0 errors)
done
Pass completed, 72 bad blocks found. (72/0/0 errors)
我认为我必须hdparm
再次使用,对吗?有没有聪明的方法可以自动化,而不是启动命令 72 次?我可以编写一个 Python 脚本将它们与“;”连接起来,但如果有聪明的方法,请告诉我。
感谢您迄今为止的支持:)
答案1
您的hdparm
命令错误。请参阅手动的(我重点标注了):
--write-sector
将零写入指定扇区号。非常危险。必须提供扇区号(base10) 使用此选项后.
hdparm
将向指定扇区发出低级写入(完全绕过通常的块层读/写机制)。这可用于强制驱动器修复坏扇区(介质错误)。
适合您目的的正确命令似乎是
sudo hdparm --write-sector 618997831 --yes-i-know-what-i-am-doing /dev/sdb
编辑:由于您现在已经将问题扩展到不仅仅是一个坏块,全部检测到坏块,我将这个问题标记为与处理让磁盘驱动器控制器使用备用保留块重新分配坏块的更普遍问题的问题重复。
答案2
您可以使用dd
以下方法一次性写入所有 72 个扇区:
sudo dd if=/dev/zero of=/dev/sda bs=512 seek=545995273 count=72
至于驱动器是否物理损坏,请检查 SMART 统计数据,但由于有这么多坏扇区,我怀疑不仅仅是电源故障,电源故障往往只会损坏一个扇区。写入后,如果 SMART 统计数据显示您有一堆重新分配的扇区,那么它们就是物理损坏的,您应该更换驱动器。
答案3
您可以运行sudo fsck /dev/sdb
,这应该可以修复您遇到的所有坏扇区。如果您在更新过程中断电,您可能需要尝试再次更新,然后sudo apt-get update
运行sudo apt-get upgrade