Preventing Hard Disk Data Loss

Posted on by Larry

Recently, I wrote about a potential problem with losing data on hard drives which are powered off and sitting on a shelf. (You can read the entire article here.)

The basic problem is that when a hard disk is powered off and stored, the magnetic data on the drive has the potential to “evaporate,” meaning that you can lose all your data. (I’ve been told the term for this data loss is “bit flux.”) This data can start to disappear as early as a year after the hard disk is powered off.

After talking with a lot of hard disk folks, I learned that the easiest solution is to refresh the data on the hard disk before it starts to “fade.” All hard drives are programmed to refresh data as the heads skim along the drive. The key is to get the hard drive to read the entire disk, which would automatically refresh the data.

What I didn’t know was how … until today.

Thanks to Robert Gobeille, I now have a solution and an explanation. I’ll be adding this to my newsletter shortly, but wanted to give you the workaround here first. Feel free to share this with your friends.

When Bob first sent me the procedure, I asked him to please double-check that this is safe, find out how long a scan takes, and tell me how to escape out of it. From those questions, Robert put together the Q&A.

– – – THE PROCEDURE – – –

UPDATE: The above text was changed on Oct. 14 to speed up the disk reads. The older version worked, but the new version (adding the word “rdisk”) reads about 5 times faster.

– – – BOB’S EXPLANATION – – –

This will do no harm. The following may cause your eyes to glaze, but I’ll attempt to explain all this and keep it simple. Here is the command again:

sudo cat /dev/rdisk0 > /dev/null

sudo” is a command that says “run the following command with root (administrator) privileges. You need this privilege level to read the disk as if it is one big file (as opposed to reading each individual files).

cat” is a command that says copy the following file

/dev/rdisk0” is the name of your primary disk. It is a file name just like a .mov but it happens to represent the entire disk. Since this follows “cat”, this is the file you are copying. (Note the use of the letter “r’ in front of the word “disk”.)

> /dev/null” says to copy the file (/dev/disk0) to the file named /dev/null
/dev/null is a special type of device. Anything you write to it will be thrown away. It’s like copying things to a black hole.

So the above command means to read the entire disk and copy it to nowhere. I know this sounds strange, and yes I could write a program that reads the entire disk without “copying to nowhere”, but the above is pretty simple.

Start Activity Monitor.app (in your Applications/Utilities directory) and select “Disk Activity”. Then run the above command. You will see lots of data read but none written.

Q: How long will this take?
A: I’m running it on my MacBook Pro as I write this. I see data read at 12 MB/s and the disk capacity is 232GB. So this should take around 5 hours. Nobody will probably run this on a MacBook. A Mac Pro should be considerably faster.

Q: How do I measure how long this takes?
A: Change the command to:
sudo time cat /dev/rdisk0 > /dev/null
and it print out how long it took, when it is done. The output will look funky. For example,
“12345.67 real 2.34 user 345.89 sys”
The 12345.67 is the seconds it took to run the command.

Q: How do I terminate this command once it starts?
A: In the same terminal window where you executed this command, press Control+C. That is, hold down the Control key and press the letter C.

Q: The command above says that it is reading the file /dev/disk0, but I have several disks. How do I know the correct name of the disk that I want to scan?
A: Excellent question! This is a critical point that I forgot to address above. Go into Disk Utility (in your Applications/Utilities directory). You will see all your mounted disks in the left column. This list is indented. It will say something like “232.9 GB Hitachi” and underneath that will be your volume name indented, like “Macintosh HD”.
– Click on the top line (the “232.9 GB Hitachi” line in my example)
– Click on the Info button
– Read the “Disk Identifier” line. It will say something like “disk0”. Where Disk Utility is saying “disk0” or “disk1” or “disk2”, … put an “r” in front. This is the name you use in the command (/dev/rdisk0 in this case).

Q: Will this hurt anything? What if I say /dev/rdisk0, like your first example, but I should have put in /dev/rdisk3 (which I learned from the last question?
A: If you specify the wrong disk, you will simply read the wrong disk. There is no harm in reading a disk. Obviously, you need to read the correct disk to refresh the disk but you will do no harm.

– – –

Thanks, Bob. This explains what I needed to know.


Leave a Reply

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

Larry Recommends:

FCPX 10.5 Complete

NEW & Updated!

Edit smarter with Larry’s latest training, all available in our store.

Access over 1,900 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.