Helping people with computers... one answer at a time.

File corruption happens most commonly when there's a hardware issue or bad sector on your hard drive. I'll look at implications and preventative steps.

How are files "corrupted" and why do they go "missing"? I had this happen recently and was told that it was not a virus that caused it: that it "Just happens". Whatever! Windows had to be re-loaded.

Yes, it does "just happen".

That should make you a little nervous, and perhaps motivate you to invest in that backup strategy you've been putting off. Smile

The fact is, things occasionally break, and when they break the failure can be catastrophic - as in suddenly your machine won't turn on - or much more subtle, not showing up for weeks or months or sometimes never.

For the most part, I'm talking about the hard disk in your computer.

It's not uncommon for a hard disk to develop or even come with a bad sector - an area on the magnetic media that is somehow damaged. Think of it much like a scratch on an audio compact disc; sometimes it'll play the music just fine and you'll never notice, but then sometimes it'll skip or have a little distortion. In the worst case you might not be able to play the rest of that song or disc.

"You cannot prevent a hard drive from developing bad sectors or failing."

Bad sectors develop for a number of different reasons. The magnetic media may have come with a subtle flaw or a "thin spot" that simply wears out over time. The more common cause is likely motion - a drive getting moved around while its in use, and the read/write mechanism perhaps ever so slightly touching the magnetic material and scratching it. This is one of the reasons that the more rugged laptop drives are also somewhat slower: the mechanisms are often built more solidly with motion in mind so as to minimize the possibility of this type of thing happening. But regardless of these and other causes, it can and does happen.

And when it happens to data the result is corruption - data that used to be

The quick brown fox jumps over the lazy dog.

might suddenly become:

The quick br¿-tü?hïZ»O1E¦ê¦-çCa ¦f E??IG¦Gq+

Now, it's one thing if the text you're reading is suddenly garbled like that, but if that's your financial data, or one of your installed programs - or even Windows itself - you could be in a world of hurt.

  • In the simplest case you might never notice, because the bad sector is on some unused portion of your hard disk, or in part of a file you never or rarely use, or where the corruption is actually benign. You'd simply never see it.

  • In relatively benign cases you might get a "read error" or a "CRC error" as the operating system detects that some form of data corruption had occurred.

  • As you can see above, if it happens in a data document of yours, you might open that document to find its content scrambled.

  • In more complex document formats (Microsoft Office documents are a good example), the program might not be able to even open the document due to corruption somewhere within.

  • If the corruption happens within the file that contains a computer program (an EXE or DLL file), then the program might not run at all, might crash when you do run it, or it might crash at some point when you access a certain feature that uses the instructions that have been corrupted.

  • If the corruption happens within the file system information - perhaps the information about what files are stored on the disk - files can disappear.

  • If the corruption happens within the files that comprise Windows itself, Windows can crash or even fail to boot.

  • If the corruption happens within the master boot record, partition information or other key areas of the hard disk, the entire disk may suddenly appear unformatted or empty.

As you can see, problems resulting from even a single bad sector's worth of data corruption can range from benign to disastrous.

You'll sometimes have warning. CRC errors are common as a hard disk starts to go bad, as are sudden slowdowns as the operating system attempts to read and re-read areas of the disk that are having trouble.

But you won't always get a warning. You could just wake up one morning with a dead hard drive; it quite literally has happened to me.

The good news in all this is that it's not something that happens every day. Hard drives often run for years without a problem. But in a sense it's a game of Russian Roulette: your hard drive could also develop a failure tomorrow.

So, how do you prevent it?

The most common answer is simply that you cannot. You cannot prevent a hard drive from developing bad sectors or failing. It happens. The best you can do is prepare.

There are tools - most notably SpinRite - that can "condition" your hard drive by carefully writing and rewriting your data on the drive and in doing so repair or avoid known bad areas on the drive. That can delay, sometimes significantly, a drive having a problem.

But the real "solution" is simply to know that someday when you least expect it (and perhaps when it'll be most inconvenient) it will happen, and to prepare.

And that of course means having regular backups so that when, not if, a file becomes corrupt you can repair or replace the drive and restore that file or even the entire contents of the drive as needed.

Article C3962 - December 26, 2009

Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

Recent Comments
18 Comments

There's also the bathtub curve; basically, either the drive fails right away or lasts for years. Still, things can happen, such as dropping a laptop or a power surge or accidentally swiping it with an extra-strong magnet or dust getting through the filter and causing a head crash; and of course they sometimes fail for no obvious reason. However in general it goes by the bathtub curve.

Also, do redundant backups. If you only do one backup and that goes, you're doomed.

Posted by: Me at February 9, 2010 11:58 AM

You may like this little story as an epilogue to the problems of system crashes.
MANY years ago I worked as an engineer for the 'worlds largest computer manufacturer'!? I was called in when our biggest system - based in Portsmouth - crashed at exactly 9 o'clock every morning.
We took the system apart and virtually rebuilt the hardware and software platform! With NO SOLUTION!
Then.... someone had a bright idea... The Royal Naval Radar testing station was in the hills about 2 miles away and above us and one of our managers phoned them to see if they were testing anything that might be causing problems!
30 minutes later a large group of Naval techniciams were secretly in meeting with our senior staff!
The outcome was that we encased our computer room in foil insulated shutters and the RNTS changed their testing to 2am-5am!! We had no problems after that!!
Draw your own conclusions?
Oh yes... it was NOT the hard drives that caused the failure but system boards! Nothing on the drives was ever found to be damaged.

Posted by: Menagerie at February 9, 2010 5:12 PM

In reference to the people talking about Cosmic Rays causing damage; you are CORRECT. It is one reason why ECC memory has been developed. In the unlikely event that a Cosmic Ray hits a stick of RAM, it may flip some of the "1"s to "0"s and vice-versa. ECC Memory works sort of like RAID 5 so that a hash is created for each piece of memory to ensure that when it is used, it has not been corupted by radiation.

Posted by: Pookey at February 9, 2010 6:18 PM

Leo –

Hi. I now clearly see the wisdom of your backup strategy composed of DAILY incremental backups with a monthly full backup. As in one of your examples in the article, I had two Microsoft documents (Word and Excel) on my desktop that suddenly would not open. Fortunately, I had made 2 backups of each file, each saved on separate flash drives. Unfortunately, those 2 backups were also corrupted and would not open. My full backup on a portable hard disk did have a clean copy, but it was old.

My question: Those two files were the only corrupted files (I hope, at least) and they were last modified on the same day. A subsequent Check Disk scan indicated that the volume was “clean”. Is it still likely that a bad sector had been the cause of the corruption? Can the SpinRite software you mentioned help me to recovery my files?

Thanks…

Quite possibly, yes. (Of course I can't guarantee it, but SpinRite comes with a money-back guarantee.)
Leo
15-Apr-2010

Posted by: Yeppers at April 12, 2010 8:23 AM

I never had a single problem with file corruptions up until 2000s or so. Lately it has become an everyday problem.

Yet the first and a major cause is bad technology, bad controllers, and bad programming on modern system platforms.

It is impossible -or, at least >>was The "system file" has gone missing because the system ordered/flagged it for deletion and it will get deleted during some later clean up process. Not because some disk cluster has suddenly become unreadable. Because a chkdsk would reveal that a cluster x in file xy is unreadable.

At least 70% of "files missing" and "files corrupted" are a result of programming flaws on the system. The file has become corrupted because: The system has written data in an occupied cluster arbitrarily. That's why.
Other 30% are of course caused by a bad hdd surface and anomalies.

Posted by: aeneas at November 13, 2011 8:26 AM
Post a comment on "Why, or how, do files become corrupt?":





Remember Me?

(You may use HTML tags for style)

Before commenting, please...

  • READ THE ARTICLE. A comment that shows you didn't will be deleted and ignored.

  • Comment only on the article. Use the search box at the top of the page if you have a question about something else.

  • NO PERSONAL INFORMATION in the comment. No email addresses. No phone numbers. No physical addresses.

  • Anything that looks the least bit like spam will be deleted. Links to unrelated sites or links that appear to be primarily promotional will be deleted, or the comment will be deleted.

  • Don't ask me to recover lost passwords or hacked accounts. I can't. Those comments will be deleted.

  • I can't respond to every comment. And I can't vouch for the accuracy of others who do.

Please wait. Your comment is being processed ...