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”

Newer Comments →
  1. Tod Hopkins says:

    DriveDX (Mac, $20, free download) will do a full surface scan of SMART-enabled hard drives. I’ve used this for years for this purpose. It only works with SMART-enabled drives where it can access SMART functions, but that is most drives. It’s great to have a command line alternative.
    – – –
    (Then, Tod wrote back) Of course, having just “recommended” it, DriveDX failed to scan the drive I just mounted. The drive was “interrupting” the scan. It may be an issue with Ventura power saving. I have not scanned drives since installing Ventura. I have not diagnosed the problem yet and I am using your command line. We’ll see how it goes.

  2. Larry says:

    Tod:

    Thanks for sharing this. I had not heard of DriveDX. Here’s the link:

    https://binaryfruit.com/drivedx

    As a note – given Tod’s note, be sure to confirm that DriveDX performs a full disk scan before purchasing it.

    Larry

  3. Randal Kennerley says:

    Hi Larry, In terminal I had a command line ending: username$. I had to log out before doing the disc operation. When I logged in again I had my name, in a different format, followed by “MacBook-Pro-2 ~ % ”
    This will not action the command.
    I have a screenshot.
    Any help? Thanks, Randal (UK)

  4. Larry says:

    Randal:

    Nope. I am not a Terminal expert in the least. I got this line from Tim. Perhaps another reader can suggest a workaround.

    Larry

  5. Hi Larry,

    Thank you the great tip.

    However, in the terminal command screen capture the r is missing from the if=/dev/rdisk.

    Bruce

  6. Larry says:

    Bruce:

    You eagle-eyed maven! You are correct. The command will run without the “r” – however it is more effective if the “r” is included. I checked with Tim.

    Larry

  7. Tod Hopkins says:

    Warning! If one edits this command line improperly one could erase a drive. The dd command (data duplicator) copies the source to the target, overwriting the target. In this case, the target is “null” so it is overwriting nothing. Clever. But if one were to replace “null” with a drive specification, you would overwrite that target drive. It seems like an unlikely mistake but be forewarned.

  8. Larry says:

    Tod:

    Yup. Terminal is very powerful. That’s why the command is set to only read the drive.

    I always triple-check that the text I’m entering in Terminal is correct.

    Larry

  9. Dave says:

    DriveDX does indeed do the full drive scan, probably using the “dd” command under the hood.

    https://binaryfruit.com/drivedx/help#ui-self-tests

    >Full (Long / Extended) Self-test
    >Longer, much more comprehensive and thorough version of the Short self-test, does >read scan of the entire media, with no time limit. Can be used to validate the results >of the Short self-test because Short self-test time constraint may not provide >sufficient test time to identify a fault condition.

    As you mentioned in the article, Larry, using one of OWC’s drive docks is a great idea, as they support SMART reporting.

  10. Larry says:

    Dave:

    This is excellent news, because DriveDX takes the fear out of using Terminal. Thanks.

    Larry

Newer 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.