How to Prevent or Repair Hard Drive “Data Rot”

When you have a hard disk connected to your computer, all is good. It periodically checks to be sure all data is secure.

However, when you unplug a hard drive (also called HDD) and store it on a shelf, the magnetized bits that store your data can, over time, lose their charge and its associated data. This process is called “data rot.”

The general rule is that HDDs containing data can be safely stored on a shelf for 3-5 years before problems of data loss or sticky heads (“stiction”) arise. So to prevent problems we need to “reenergize” the data on the disk.

Here’s how.


IMPORTANT NOTE: This requires using Terminal, because I don’t know of an existing utility that does this. This isn’t hard, I’ve run it myself. But, if you are not comfortable using Terminal, get a tech-savvy friend or consultant to help.


NOTE: If the drive does not have an enclosure, use a drive dock (like this Voyager from OWC) to connect it to your computer.

sudo dd if=/dev/r of=/dev/null bs=2048k status=progress

NOTE: In my case, I used: sudo dd if=/dev/rdisk11 of=/dev/null bs=2048k status=progress. That “r” before the name of the drive is important.

Terminal will ask for your password, then display a progress report on the process (red arrow above).

This command reads every sector on the disk – even if the sector is empty and even if it’s not a Mac format disk. Writing is not part of the pass since the drive firmware logic will handle sector reassignments if there are low level questionable reads. The purpose for this is twofold: keep the heads cleared of any parked “stiction” opportunities and validate the sectors on the disk via drive’s the built in block management logic.

This does not erase anything, nor write new data.

NOTE: The “sudo dd” option forces the drive to hit all of the drive’s sectors, not just those specific to any one filesystem/partition.

Most hard disks transfer data between 50 – 250 MB/second. The duration of this re-energizing process depends upon the speed of the drive and the amount of storage to be reviewed. This table can help you calculate the duration.

Time to Process 1 TB of Storage

Hard Drive Speed Hours / TB
50 MB/s 5.5 hours
100 MB/s 2.8 hours
150 MB/s 1.9 hours
200 MB/s 1.4 hours
250 MB/s 1.1 hours

From the table above, multiply the hours per terabyte times the total capacity of your hard drive to get an estimate of how long this will take. If your computer goes to sleep, it will take longer.

EXTRA CREDIT

I’m grateful for the technical assistance of Tim Jones, Chief Solutions Architect at OWC, in providing and verifying the Terminal instructions.


Bookmark the permalink.

24 Responses to How to Prevent or Repair Hard Drive “Data Rot”

← Older Comments
  1. Brian Thomas says:

    Thanks Larry. As I mentioned, your tip works perfectly for me provided, in Disk Utility, a line showing ‘Container’ does not appear between the two lines you show in your examples. (I have quite a few HDDs as I look after the archives of a number of groups, schools etc. thus my interest in all this.)

    Now that I’m aware of the ‘rot’ risk I’ll stop pondering Terminal and try out DX. I’ll come back and post my experience in case someone else hits this too.

  2. Larry says:

    Brian:

    Just as a reminder, the Container feature only applies to drives formatted as APFS. This is best used for SSDs. HFS+ is the strongly preferred choice for spinning hard disks. Most of the time, then, you should not need to see a container. Also, keep in mind that this re-energizing ONLY applies to spinning hard disks. There is no reason to use it for SSDs or SSD RAIDs.

    Larry

  3. Brian Thomas says:

    Thanks Larry, as I work through all my spinning drives it’s becoming clear that this works great for Mac OS Ext and NTFS but not for APFS which, as you point out, have this ‘container’. I don’t know why I formatted some of those drives as APFS but in every other respect they seem to work fine.

    I had a large WD SSD late last year but it provoked frequent unexpected reboots of my M1 MacBook Pro so I sent it back.

    One other little thing: yesterday I wanted to stop the process on a 1TB drive. Ejecting using Finder got rid of the drive in the sidebar but it was still going in Terminal. Ejecting within Disk Utility ‘failed’ as ‘it is currently in use’. In desperation (and knowing I had another good copy of that drive) I restarted my machine which had the desired effect. Might you perhaps know of a more elegant way of halting the process? Many thanks in advance.

  4. Larry says:

    Brian:

    APFS was designed, from the beginning, for SSDs, not spinning hard disks. If at all possible, backup the data on any HDD (spinning hard drive), then reformat it to HFS+. It is too complex to explain all the reasons why, but HFS+ is always the best option for HDDs.

    As for Terminal, Control+C is the traditional way to stop an on-going process.

    Larry

← Older Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Everything You Need to Know


2,000 Video Training Titles

  • Apple Final Cut Pro
  • Adobe Premiere Pro
  • DaVinci Resolve

Edit smarter with Larry Jordan. Available in our store.

Access over 2,000 on-demand video editing courses. Become a member of our Video Training Library today!


JOIN NOW

Subscribe to Larry's FREE weekly newsletter and
save 10%
on your first purchase.