Nothing to do with politicians and money
File corruption is a form of accidental or unintended damage to the data in a file. File corruption comes in many shapes and happens for various reasons, but the result is the same: you can’t read your data.
In some cases, you can reverse or repair file corruption, but that’s not always possible. It’s better to understand why corruption can happen and how you might be able to safeguard against it.
What Does It Mean for Files to be Corrupted?
A “file” is a collection of related data that should be read as a unit, written in a specific file format. For example, all the data in a Microsoft Office Word file is related to the Word document you created and stored in the .docx file format. If half the file were suddenly unreadable, you probably wouldn’t be able to open your document. Even if you could, lots of information would be missing. Likewise, an Excel spreadsheet with random values missing or changed would be worthless.
Any computer file consists of binary code. It’s a string of ones and zeros grouped into sets of bits, which represent data such as a letter.
In ASCII code, the letter “A” is represented by the binary code 01000001. If we change a single bit, such as the last 1 into a 0, then the “A” becomes an “@”!
This is how corruption works at a basic level. The values of bits inside a file are changed or erased, leading to an unreadable or only partially readable file.
How to Tell if File Corruption Has Occurred
File corruption can have various symptoms, depending on which files have been corrupted and how important they are.
Cyclic Redundancy Check (CRC) checks whether a file is whole and correctly stored. CRCs apply a formula to the data in the original pristine file, which results in a number as the output. If you apply the same formula to any copy of that file, that number should be the same. If the number is different, you’re dealing with a damaged or altered file.
You’ll most often see this error when trying to copy data from a damaged optical disk or dying hard drive, but many apps can give a CRC error when they self-check their files against a table of correct values.
File Opening Errors
If a file is corrupted, it either won’t open or will open with garbled results. Some file types are streamed and somewhat tolerant to damage. For example, if you have a video file with some corruption, media player apps may show picture breakup or stutter, but otherwise, play the entire file.
Other types of files, such as program executables, have to be 100% whole, or the program will not start.
And other file types, such as documents you’ve created, may open but be missing vital information, such as actual values from the document or formatting.
Strange Behaviors and Glitches
When resource or settings files that an application needs become corrupted, they may show up more subtly. The program won’t necessarily fail to start, but some subcomponents that rely on those files could give errors, do nothing, or crash the whole application.
System Crashes and Instability
When you get corrupted system files, it can fundamentally affect your computer. You may get sudden seemingly random BSODs (Blue Screen of Death) computer crashes or have a system that hangs or doesn’t work the way it’s meant to. Critical file corruption of this type is the most devastating and can often point to a severe problem with your hardware in many cases.
Why Does File Corruption Happen?
Now we know what corruption is, but how does it happen?
Although corruption is just the alteration of bit values chaotically and destructively, the causes of those changing values vary a great deal. This is mainly because computer media comes in many different forms and stores binary digits in very different ways.
Sudden Power Loss
One of the most common reasons a storage device experiences file corruption is a sudden power outage. This is especially true of mechanical hard drives, where cutting the power while writing to the disk can wipe out data. In the past, the read/write head of the disk could crash into the platter if they lost power, but modern drives can still safely “park” their heads even when the power suddenly goes out.
This does not mean that mechanical or solid-state drives are impervious to corruption through data loss. If the drive was actively writing data when the power went out, only part of the file might have made it into the disk. Both types of drives use volatile cache memory. This means the data inside them is lost if the power goes out.
All storage media have limited lifespans. They can wear out or begin to malfunction. Sometimes, this failure happens slowly over time, and sometimes, it’s sudden. Anyone who has dealt with mechanical hard disks knows the dreaded “click of death” many drives make before dying a short while later.
It’s not just hard drives, either. Faulty RAM can cause data corruption as the wrong values are written to the disk, scratched optical disks can be unreadable thanks to the physical damage, and so on.
Malware includes any software written with deliberate malicious intent. Data corruption or destruction resulting from malware infection can be by design or by accident. Malware authors don’t have much motivation to destroy your data for the most part. Instead, they’d hold it hostage for money (ransomware) or steal it to sell on the black market.
In some cases, malware is written simply to sow chaos and destruction. Malware designed to corrupt or destroy data usually does so in a way that’s virtually impossible to recover.
Preventing and Reversing File Corruption
It’s always better to prevent corruption from affecting you in the first place, but there are also ways to reverse it in some cases.
Check Disks for Errors
You can use various Microsoft Windows and third-party utilities to check for current errors such as bad sectors on your drives. You can also use utilities to diagnose the drive’s operational logs to predict whether the failure is imminent, giving you time to move that data elsewhere.
Check out How to Check Your Hard Drive for Errors for detailed instructions.
Make Frequent Backups
“Backing up” data describes a wide variety of practices. These include cloning your entire drive in case it fails, creating ZIP file archives, backing up specific files to the cloud, automatically making incremental backups to an external drive, and more. If you have recent data backups, then corruption becomes an annoyance rather than a disaster.
If you want to know more about making backups, we have several valuable guides:
- Create a Windows 10 System Image Backup
- How To Set Up An Automatic Backup System For Windows
- How to Automatically Backup Files to Google Drive or OneDrive
- OTT Guide to Backups, System Images, and Recovery in Windows 10
These should have you covered for backups on modern Windows systems, but macOS users can check out our Time Machine guide.
As an added precaution, you can also manually create a System Restore point to roll back to a previous version of your Windows installation before destructive file changes not related to hardware failure.
Use File Verification Features
Some software clients can also run file verification operations. For example, the Steam video game client can check whether a game’s files have been altered and restore the original data from a master online copy.
Eject Drives Before Removing Them
Regardless of the disk type or operating system, you should eject drives before unplugging them. At the very least, wait until the disk activity light has stopped before unplugging it, but ideally, take a second or two to eject a flash drive or external hard disk.
Use Antivirus Software
Use the System File Checker (SFC)
In some cases, you can determine if corruption has happened to your files and repair them automatically. Windows has several file repair tools to fix corrupted Windows system files, such as the System File Checker. You can get the exact details in our guide to Using the Command Prompt Commands to Fix or Repair Corrupt Files, which also covers the DISM tool and SCANNOW command. You may also want to try the CHKDSK command for drive error detection.
Pay For Data Recovery
The last resort is to get specialized file recovery software (almost always paid) or hire a data recovery company to reconstruct as much of your data as possible. This is very expensive and only worth doing if the value of the data far exceeds the cost of recovery. So it’s usually worth troubleshooting things before pulling out your credit card to buy file repair software.
If you haven’t experienced data corruption, it’s not too late to implement some preventative measures we listed above. Even if only for your most valuable and irreplaceable data.