When someone discusses preserving sensitive data, you'll probably hear the term "data corruption" used a few times. But what is data corruption exactly, and how can you fix your files if things go wrong?

Let's break down data corruption and how you can avoid losing your data.

What Is Data Corruption?

Imagine you work in a hospital which uses filing cabinets to store patient details. Every patient has a folder with all of their personal information within it, and every folder has a set place in a drawer that covers names in a specific range.

This hospital is particularly busy, so drawers are continually opened and closed, and folders are being extracted and put back. From this, you can imagine how information can be scrambled using this system.

Some flaws include:

  • As people remove and replace folders, the individual papers inside are replaced out of order, damaged, or even lost altogether.
  • When transferring a file from one hospital to another, some papers could go missing from folders.
  • A doctor may fill out a prescription form wrong and put incorrect information into a folder.
  • A doctor can take a folder home to study it, only to forget to bring it back. If he does remember, the folder may return with all the pages in an incorrect order.
  • A patient called Tony Smith may have their details jumbled up with another patient with the same name, so Tony Smith's folder contains the records of two unrelated people.
  • A drawer may jam up, so every patient with names between J-L can't have their records accessed.
  • In an absolute worst-case scenario, vandals or natural disasters can destroy entire cabinets!

While a hard drive isn't a filing cabinet, it does store information and data like one. Hard drives store data as magnetized or demagnetized areas, which represent a 1 or a 0 respectively. In case you're wondering; yes, this is what makes up binary code!

What Is a Corrupted File?

When a file becomes corrupted, it's akin to a damaged folder in the example above. When doctors scramble up, damage, or lose pages within a folder, it makes a patient's records unreadable.

Similarly, digital corruption occurs when a file's data becomes scrambled. This is when the 1s and 0s that make up the file are messed with, which then damages the integrity of the file.

For example, if you open a text document that suffered corruption, you may see odd ASCII characters and words within the document If the file suffers severe corruption, the computer won't be able to open it at all. Instead, it displays an error message saying it can't read the file.

Causes of Data Corruption

Data can become corrupted during writing, editing, or transfer to another drive. When a program writes incorrect data, or when something interrupts a write process, the data can mess up and cause a corrupted file.

A virus can corrupt files as well. Typically, this is done intentionally to damage essential system files. By corrupting a few critical files in the operating system, a virus can create a ripple effect that prevents the computer from booting correctly.

A hard drive contains a spinning disk called a "platter", where it stores all the 1s and 0s that make up your files. Sometimes, parts of the hard drive become "locked away" due to an accidental software error, which is called a "soft bad sector." This prevents access to data within that sector. You can repair soft bad sectors by doing a disk scan, which untangles the problem causing the lock.

Unfortunately, you can physically damage the platter via impact damage or overheating. This creates a "hard bad sector," where a section of the drive becomes permanently unreadable. This destroys the data in that sector.

Even if you take good care of your drive and install a good antivirus, hard drives are mechanical devices that naturally deteriorate over time. As such, old drives will slowly decay and corrupt its data as its lifespan dwindles.

How to Check a Hard Drive's Health

If you want to monitor the health of your hard drive, you can analyze it using special tools. These tools check your hard drive's Self-Monitoring, Analysis, and Reporting Technology (S.M.A.R.T.).

Hard drives can monitor their health and inform the computer if problems arise, but you can manually check it yourself to see if anything is going wrong. That way, you can prepare for the worst before it actually happens.

CrystalDisk Info is a great tool to do this. Once you've downloaded it and opened it up, you'll see all the statistics of your hard drive, along with a grade of its overall health. You can use this information to see if your hard drive is staying strong or is ready to kick the bucket.

How to Fix a Corrupted Hard Drive

Fixing a Hard Drive Using Windows

For a Windows-based machine, use the Checkdisk command to scan the hard drive for flaws. You can perform a disk check by pressing Win + X, clicking on Windows Powershell (Admin), and entering chkdsk c: /f /r /x. You may need to change the "c:" if your Windows 10 is on a different drive.

This command tells the chkdsk process to scan your system, with a few added parameters. The /f tells it to hunt down and fix errors. The /r tells it to recover data trapped in a bad sector. Finally, the /x tells chkdisk to unmount the drive so it can do its job.

A word of warning, however; this disk check can take a few hours (if not a full day!) to complete, so be sure you don't want to use the machine for an extended period while you do this.

Chkdsk is a very useful tool, and there are even more chkdsk commands for Windows 10 beyond repairing corrupted files.

Fixing a Hard Drive Using macOS

If you're using macOS, you can do a similar action by clicking the Apple menu button, then Restart. Hold down Command+R until the Apple logo appears. Select Disk Utility, then Continue. On View, click Show All Devices, click on your drive, then click the First Aid button---it looks like a stethoscope.

The operating system will then scan your disk and attempt to fix any corruption it finds.

Extracting Data From an Unrecoverable Drive

If you've tried your best to fix the corruption, but nothing seems to work, you can recover the drive by doing a full hard drive format. This trick clears the slate of the corrupted data and refreshes your PC back to normal, but if you're doing a full format, you'll end up losing all of your data.

Thankfully, there are ways to save your data. For one, you can transfer the data to another hard drive, so you can keep your files before the wipe. This method requires connecting the corrupted drive to a healthy one, then telling the healthy drive to copy the files over onto it.

You can also use data recovery tools to rescue some files before the formatting occurs. The success rate depends on how severe the corruption is, but hopefully, you'll be able to recover some files before the wipe!

The Importance of Backups for Data Corruption

Of course, there's no need to do any of this if you keep a regular back-up of your data. You don't need to store away your entire computer; just the sensitive documents that would be highly damaging if they vanished for good.

If you want to make a backup of your files, various backup methods are available to you. The key is to find the one that suits your needs and budget, so you can keep your files safe with minimal hassle.

Keeping Your Data Safe

Data corruption can do severe damage to your important files. That's why it's important to keep backups and treat your hard drive with care to avoid losing irreplaceable files and folders.

Want to protect your data further? Be sure to know the signs of a failing hard drive.