硬盘上的数据会在没有损坏警告的情况下降级吗?

我们都担心保持数据和文件的安全和完整,但是否有可能数据被损坏,并且在没有任何问题通知或警告的情况下被用户访问?今天的超级用户问答帖子回答了一位忧心忡忡的读者的问题。...

硬盘上的数据会在没有损坏警告的情况下降级吗?

我们都担心保持数据和文件的安全和完整,但是否有可能数据被损坏,并且在没有任何问题通知或警告的情况下被用户访问?今天的超级用户问答帖子回答了一位忧心忡忡的读者的问题。

今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。

图片由通用公司(Flickr)提供。

问题

超级用户阅读器topo morto想知道硬盘上的数据是否可以降级,是否可以在没有损坏警告的情况下访问:

Is it possible that physical degradation of a hard drive could cause bits to “flip” in a file’s contents without the operating system noticing the change and notifying the user about it when reading the file? For example, could a “p” (binary 01110000) in an ASCII text file change to a “q” (binary 01110001), then when a user opens the file, they see “q” without being aware that a failure has occurred?

I am interested in answers relating to FAT, NTFS, or ReFS (if it makes a difference). I want to know if operating systems protect users from this, or if we should be checking our data for variances between copies over time.

硬盘上的数据是否会降级,并且可以在没有损坏警告的情况下访问?

答案

超级用户贡献者Guntram Blohm为我们提供了答案:

Yes, there is a thing called bit rot. But no, it will not affect a user unnoticed.

When a hard drive writes a sector to the platters, it does not just write the bits in the same way that they are stored in RAM, it uses an encoding to make sure there are no sequences of the same bit that are too long. It also adds ECC codes that allow it to repair errors that affect a few bits and detect errors that affect more than a few bits.

When the hard drive reads the sector, it checks these ECC codes and repairs the data if necessary (and if possible). What happens next depends on the circumstances and the firmware of the hard drive, which is influenced by the designation of the drive.

  • If a sector can be read and has no ECC code problems, then it is passed on to the operating system.
  • If a sector can be repaired easily, the repaired version may be written to disk, read back, then verified to determine if the error was a random one (i.e. co**ic rays, etc.) or if there is a systematic error with the media.
  • If the hard drive determines that there is an error with the media, it reallocates the sector.
  • If a sector can be neither read nor corrected after a few read attempts (on a hard drive that is designated as a RAID hard drive), then the hard drive will give up, reallocate the sector, and tell the controller that there was a problem. It relies on the RAID controller to rec***truct the sector from the other RAID members and write it back to the failed hard drive, which then stores it in the reallocated sector (that hopefully does not have a problem).
  • If a sector cannot be read or corrected on a desktop’s hard drive, then the hard drive will engage in more attempts to read it. Depending on the quality of the hard drive, this might involve repositioning the head, checking to see if there are any bits that flip when read repeatedly, checking which bits are the weakest, and a few other things. If any of these attempts succeed, the hard drive will reallocate the sector and write back the repaired data.

This is one of the main differences between hard drives that are sold as “desktop”, “NAS/RAID”, or “video surveillance” hard drives. A RAID hard drive can just give up quickly and make the controller repair the sector to avoid latency on the user’s side. A desktop hard drive will continue trying again and again because having the user wait a few seconds is probably better than telling them the data is lost. And a video hard drive values c***tant data rates more than error recovery as a damaged frame will typically not even be noticed.

At any rate, the hard drive will know if there has been bit rot, will typically recover from it, and if it cannot, it will tell the controller which will in turn tell the driver which will then tell the operating system. Then, it is up to the operating system to present the error to the user and act on it. This is why cybernard says:

  • I have never witnessed a single bit error myself, but I have seen plenty of hard drives where entire sectors have failed.

The hard drive will know if there is something wrong with a sector, but it will not know which bits have failed. A single bit that has failed will always be caught by ECC.

Please note that chkdsk and file systems that automatically repair themselves do not address repairing data within files. These are targeted at corruption within the structure of the file system itself, like a difference in a file’s size between the directory entry and the number of allocated blocks. The self-healing feature of NTFS will detect structural damage and prevent it from affecting your data further, but it will not repair any data that is already damaged.

There are, of course, other reas*** why data may become damaged. For example, bad RAM on a controller may alter data before it is even sent to the hard drive. In that case, no mechani** on the hard drive will detect or repair the data, and this may be one reason why the structure of a file system is damaged. Other reas*** include software bugs, blackouts while writing to the hard drive (although this is addressed by file system journaling), or bad file system drivers (the NTFS driver on Linux defaulted to read-only for a long time since NTFS was reverse engineered, not documented, and the developers did not trust their own code).

  • I had this scenario once where an application would save all of its files to two different servers in two different data centers in order to keep a working copy of the data available under all circumstances. After a few months, we noticed that about 0.1 percent of all the copied files did not match the MD5 check sum that the application stored in its database. It turned out to be a faulty fiber cable between the server and the SAN.

These other reas*** are why some file systems, like ZFS, keep additional check sum information in order to detect errors. They are designed to protect you from a lot more things that can go wrong than just bit rot.


有什么要补充的解释吗?在评论中发出声音。想从其他精通技术的Stack Exchange用户那里了解更多答案吗?在这里查看完整的讨论主题。

  • 发表于 2021-04-09 15:31
  • 阅读 ( 267 )
  • 分类:互联网

你可能感兴趣的文章

你的公羊即将失败的5个迹象和症状

...算机的短期内存,它存储着你的计算机正在使用的数据。硬盘是一种长期内存,用于保存重启之间需要访问的内容。 ...

  • 发布于 2021-03-17 16:18
  • 阅读 ( 220 )

5个警告信号您的ssd即将发生故障

固态驱动器(SSD)比传统的硬盘驱动器(HDD)更快、更稳定、功耗更低。但是固态硬盘并不是完美无缺的,在预期的5到7年的使用寿命之前就可能出现故障。 ...

  • 发布于 2021-03-18 00:44
  • 阅读 ( 460 )

如何在windows10中修复速度较慢的外部硬盘

把外置硬盘**电脑后,发现它比以前慢了?如果你经常使用这个驱动器,这很容易解释:可能是因为它太旧了或者需要碎片整理。 ...

  • 发布于 2021-03-25 23:19
  • 阅读 ( 314 )

是否可以从发生故障的ssd恢复数据?你需要知道的

当固态硬盘(SSD)开始进入市场时,它们以其速度和可靠性而备受赞誉。用户认为,由于SSD没有机械部件,因此发生机械故障的可能性较小。 ...

  • 发布于 2021-03-30 21:18
  • 阅读 ( 355 )

mac上的“磁盘未正确弹出”是什么意思?

...源的小型设备来说,这可能是一件大事。例如,突然切断硬盘的电源可能会损坏硬盘。即使是闪存驱动器也需要电源才能成功完成写入操作,而且您可能会过早地拔掉电源。弹出将向驱动器发送信号以正常关闭电源。 相关:什...

  • 发布于 2021-03-31 10:32
  • 阅读 ( 157 )

如何通过重建ps4数据库修复ps4问题

...。这将导致更快的启动时间和更灵敏的控制台。 这与对硬盘进行碎片整理不同,这一过程需要更长的时间。碎片整理会移动数据,而重建数据库只会影响数据库。重建数据库后,控制台会记录相关数据在驱动器上的位置,然后...

  • 发布于 2021-04-01 18:25
  • 阅读 ( 307 )

如何更换synology nas中出现故障的硬盘

硬盘死机从来都不是一件有趣的事,但Synology至少让更换NAS中的死机变得相当容易。你可以不必大惊小怪地重新站起来跑步。下面是如何做到这一点。 相关:当你的硬盘出现故障时该怎么办 如果您现在处于这种情况,希望您正...

  • 发布于 2021-04-06 08:45
  • 阅读 ( 339 )

当你的硬盘坏了怎么办

就像每一件硬件一样,硬盘也会出故障。特别是机械硬盘,其运动部件可能(最终)停止工作。即使是没有运动部件的固态驱动器也可能出现故障。每个驱动器在启动前都有一个有限的寿命。 相关:备份我的电脑最好的方法是...

  • 发布于 2021-04-06 19:16
  • 阅读 ( 240 )

如何判断你的硬盘是否因s.m.a.r.t而死亡。

硬盘使用S.M.A.R.T.(自我监控、分析和报告技术)来衡量自身的可靠性,并确定是否出现故障。你可以查看硬盘上的s.M.A.R.T.数据,看看它是否开始出现问题。 硬盘不会永远存在,而且你常常看不到终结的到来。幸运的是,大多...

  • 发布于 2021-04-08 04:12
  • 阅读 ( 151 )

如何从死机中恢复文件

...。 无法保证您的数据是可恢复的。如果您的计算机由于硬盘故障而无法工作,则可能无法恢复文件——至少没有某种昂贵的专业数据恢复服务。 从linux live cd(或windows安装光盘)引导 如果你的电脑硬件真的死在你身上了,这...

  • 发布于 2021-04-08 11:03
  • 阅读 ( 163 )
w91395898
w91395898

0 篇文章

相关推荐