检查硬盘坏道 [英] check for bad sectors on hard disk

查看:141
本文介绍了检查硬盘坏道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近一停电后,我的电脑已经变得相当搞砸了(BSODs飘飞,整个操作系统的行为真的很奇怪)。

Recently after a couple of power outages, my computer has gotten quite messed up (BSODs every now and then, entire OS behaves really strange).

现在我有跑完全没有我的电脑弄乱之前的程序。这个程序基本上只是创建一个使用的 的CreateFile 并使用的 WriteFile的 。此程序还具有其他的东西,在此基础上做档案的事情。我注意到,整个程序行事诡异的为好。

Now I have a program that ran perfectly fine before my computer got messed up. This program just basically creates a file using CreateFile and writes to it using WriteFile. This program also has other stuff doing their thing based on this file. I noticed that the entire program acted strangely as well.

我的调试结果:


  • 我注意到,在的CreateFile ,该文件被创建在哪里
    应该是(用资源管理器和命令行检查)。

  • WriteFile的并没有写入文件(使用资源管理器和命令行再次检查)。

  • WriteFile的,每当我双击在资源管理器中的文件或做与该文件做任何事,一切都表现得好像该文件不存在。

  • 所有API返回各自的成功codeS。没有绝对的错误。

  • 我停止我的程序,并退出了IDE后,我去探险家和试图删除包含上面创建的文件的文件夹,这表明我:

  • I noticed that after CreateFile, the file is created where it should be (checked using Explorer and command-line).
  • WriteFile did not write to the file (again checked using Explorer and command-line).
  • After WriteFile, whenever I double-clicked on the file in Explorer or did anything with that file, everything behaved as though the file did not exist.
  • All APIs returned their respective success codes. No error absolutely.
  • After I stopped my program and exited the IDE, I went to explorer and tried to delete the folder which contains the file created above, it showed me this:

该文件得到了虽然删除。

The file got deleted though.

注意:以上并不总是发生

由于上述调试,我来到该感谢我的整个操作系统举止怪异的结论,我的程序还充当奇怪。在我的程序无故障(因为一切那些该死的停电前的工作完美)。

Due to the above debugging, I came to the conclusion that thanks to my entire OS acting strange, my program also acts strangely. No fault in my program (since everything worked perfect before those darned power outages).

不管怎样,微软<一个href=\"http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/error-0x80070091-the-directory-is-not-empty-while/8c58e1d9-b6f2-4164-8fa6-19f35c09ea3d\"相对=nofollow>此要说的就是这些错误。基本上,我的硬盘有许多不好的行业。

Anyway, Microsoft has this to say about that error. Basically that my hard drive has many bad-sectors.

我的问题:有没有以编程方式检查是否有硬盘驱动器C是罚款?这种检测不一定是100%正确的。我这样做,但是,希望这个检查是相当快的(因为我做了很多写和等)。

My question: Is there any way to programmatically check if a hard drive is fine in C? This detection need not be 100% correct. I do, however, want this check to be quite fast (since I do a lot of writes and such).

我想,因为截至目前,我的程序的其他人员认为,该文件是存在的,并准备(因为没有返回错误)和怪异的行为的各种随之而来此检查。至于谁可能不知道他/她的硬盘驱动器是发呆的用户,我想我的程序建议运行磁盘检查。

I want this check because as of now, the rest of my program thinks that the file is there and ready (because nothing returned an error) and all sorts of weird behaviour ensues. As a user who might not know that his/her hard-drive is zonked, I would like my program to suggest running a disk check.

推荐答案

您可能会更好看S.M.A.R.T prefailure通知,通过API发生之前,允许驱动器有问题的早期预警。 这里是一种实现,我发现它很快似乎是你的平台,但是我没有测试它。

You might be better off looking at S.M.A.R.T prefailure notifications, through an API that allows early warning of drive issues before they occur. Here is one implementation I found quickly which appears to be for your platform, but I have not tested it.

我怀疑有可用的更好的。他们变得重要在此之前SMART方法的主要优点是找到问题。然而,许多操作系统有这个功能内置的,也很少在比磁盘实用程序以外的其他应用层面做到这一点。

I suspect there are better ones available. The main advantage of this SMART approach is finding issues before they become important. However, many operating systems have this functionality built in, it's rare to do it at the application level in something other than a disk utility.

这篇关于检查硬盘坏道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆