You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Disk Utility: for bad blocks on hard disks, are seven overwrites any more effective than a single pass of zeros?

In this topic I'm not interested in security or data remanence (for such things we can turn to e.g. Wilders Security Forums).


I'm interested solely in best practice approaches to dealing with bad blocks on hard disks.


I read potentially conflicting information. Examples:


… 7-way write (not just zero all, it does NOT do a reliable safe job mapping out bad blocks) …

https://discussions.apple.com/thread/1732448?answerId=8191915022#8191915022 (2008-09-29)


… In theory zero all might find weak or bad blocks but there are better tools …

https://discussions.apple.com/thread/2362269?answerId=11199777022#11199777022 (2010-03-09)


… substitution will happen on the first re-write with Zeroes. More passes just takes longer.

https://discussions.apple.com/thread/2507329?answerId=12414270022#12414270022 (2010-10-12)


For bad block purposes alone I can't imagine seven overwrites being any more effective than a single pass of zeros.


Please, can anyone elaborate?


Anecdotally, I did find that a Disk Utility single pass of zeros seemed to make good (good enough for a particular purpose) a disk that was previously unreliable (a disk drive that had been dropped).

Intel and PowerPC desktops and laptops, Intel and G4 Xserves, Xserve RAIDs, Mac OS X (10.6.7), Mac OS X 10.5.8 and 10.6.7, Mac OS X Server 10.5.8 and 10.6.7

Posted on Apr 21, 2011 12:22 PM

Reply
28 replies

Nov 7, 2013 1:46 PM in response to Graham Perrin

The problem is:

Depending on the disc, the number of bad blocks can increase very fast.

That is not always the case, but I have seen this occasionally.


Usually I use the badblocks command on Linux to test hard drives.

The nice thing is that you see the block numbers that failed,

which gives you a good feeling what is going on.

Furthermore you see how it slows down when blocks are still readable but if it requires

multiple spins of the disc to read the block.


If a disc fails I would not trust it any more - see below:


When performing multiple scans I found that blocks that could be read on the first pass

but which are close to blocks that failed on the first pass have an increased likelihood to fail on the second pass.

I had more than one disk for which this never converged after a reasonable number of passes,

i.e. on which the bad part increased steadily in size.


I also had a disc on which the number of bad blocks remained unchanged after the first pass.

But still I would not trust this disc.

If you have important data I would not put it on a bad disc.

If your data is not important, I would consider to delete it.

Apr 19, 2014 4:11 PM in response to Graham Perrin

Many of the products pitched in this thread aren't needed if you're confident in your ability to use a shell. Most hard drives that would be flagged by the recommendations in this thread will also be perfectly good hardware.


Read errors are a common result of cutting power or highly unstable AC power. Desktop (non-enterprise) drives often don't handle either of these very well. A brown out or hard power cut can give a read error that is safely handled with a single overwrite.


To check drive status, you can use the smartctl utility to check your drive's SMART status. There are many free builds available, including in MacPorts. If you see 197 and 198 errors in an equal count and everything else is within tolerance, your next step should be to try finding what files have a problem. You want to try overwriting these.


To find the files, use fsck_hfs to perform a block scan. This can take hours to complete, but you can do it on a live system. Look at man fsck_hfs for the -S option.


To overwrite the files, move the affected files to your trash, enable the Finder option to securely erase files (this performs an overwrite), then check whether the 197 and 198 errors are now zero level.


If fsck_hfs didn't find files that account for all blocks, your next step is to use Disk Utility to zero out free space on your drive, then check smartctl again.


If your only errors were 197 and 198 type, and if they're all now zero, you're done. No need to replace your drive unless this becomes a common occurrence, and unless you're certain you're providing steady power to your Mac and aren't powering down hard.

Apr 20, 2014 3:26 AM in response to McGroarty

Many people are NOT familiar with booting into single user mode, running fsck, or perhaps running the command line version of smartctl, a smartmontools subset. People buy third party tools to make life easy on themselves. I also have questions about your methodology and results.


First off, asking people to boot into single user, command line mode to run fsck is a bit abnormal. Rather 1970's- ish is how I'd put it.


Second, fsck checks the file system integrity, not necessarily bad blocks. The gist of this thread is about media failures, not B-Tree indexing problems. fsck variants only check for correlation between what's contained in the index files and that which is stored on disk. It does not check for any bad blocks in media regions that are not used by the drive.


Third, smartctl and smartmontools are well beyond the scope of most users. There are a few SMART monitoring tools on the market that haven't been mentioned here that are really nothing more than smartctl interpreters. They likely exec the smartcl application via an NSTask instance, obtain the response from smartctl, and then graphically map it out for users. It makes it easier for users to understand. I have no qualm with people doing this as long as they make it clear that what they are doing is interpreting an open source product. As an FYI, I'm reasonably certain that Scannerz uses the same SMART monitoring that Apple does, and TechTool Pro and Drive Genius seem to have their own regiment. It doesn't matter, really, as long as they report it fairly, IMHO.


Fourth, SMART monitoring has been heavily criticized because it only detects problems after the fact. For example, Scannerz, TechTool Pro, and Drive Genius all scan the media of the entire drive at a low level, regardless whether the drive has indexing problems or not and regardless of whether data is present. If any of these detect problems with a sector or a block , they will flag it, whereas SMART will never even be aware bad blocks until a write failure is detected. I would recommend you look up SMART monitoring on Wikipedia and also take a look at the Google study about its reliablity. There are many reports on the web where SMART has indicated a drive is about to fail at any instance, only to have the drive last for years, or on the other extreme, cases where a drive fell flat on its face with no SMART indicators indicating immenent failure. SMART technology is inconsistently implemented from manufacturer to manufacturer.


Fifth, I think it's bad advice to essentially imply to people that a drive with potential problems is "OK." A drive with problems is a drive with problems. If all anyone has stored on it is games or other trivial data, so what? But what about people that have tax returns, critical financial data, or other important and critical information stored on their drives? What you're proposing is essentially is for people to essentially take a "crap shoot" with what might be exceptionally important information. What you should be emphasizing is backups.


Finally, I like it when I see "fans" of a product make it aware to me, I'm greatful. I don't care if they're just "fans" or perhaps diabolical marketing conspirators, as long as they're not obnoxious about it. Please keep in mind that on many general computer websites there are often outbreaks of Mac vs. PC, and I seriously doubt that there's a barrage of Apple or Microsoft employees participating in them. A fan or satisified user is likely nothing more than that.

Apr 20, 2014 7:39 AM in response to ThomasB2010

ThomasB2010 wrote:


Many people are NOT familiar with booting into single user mode, running fsck, or perhaps running the command line version of smartctl, a smartmontools subset. People buy third party tools to make life easy on themselves. I also have questions about your methodology and results.


As I said, my reply was for people who are comfortable with the shell. If people are more comfortable with a packaged solution, I expect they would have stopped with that caveat. However, some of us are more comfortable using tools that have been provided by the OS vendor, or which have matured over decades.



ThomasB2010 wrote:


First off, asking people to boot into single user, command line mode to run fsck is a bit abnormal. Rather 1970's- ish is how I'd put it.


Newer is not always better. Not all of us trust a lone dev or two to come up with something that somehow trumps the decades of experience and domain knowledge of OS developers and storage professionals, and to then paint a nice GUI over it as the cherry on top.


While I haven't explored this space much on the Mac, the Windows drive utility marketplace is full of snake oil that does nothing meaningful, or even does more harm than good.



ThomasB2010 wrote:


Second, fsck checks the file system integrity, not necessarily bad blocks. The gist of this thread is about media failures, not B-Tree indexing problems. fsck variants only check for correlation between what's contained in the index files and that which is stored on disk. It does not check for any bad blocks in media regions that are not used by the drive.


[...]


You are wrong.


As I said in my reply, look at the "-S" option. fsck_hfs with the -S option performs a complete surface scan and not only identifies bad blocks, but which files they're associated with (if any). It also identifies bad blocks that are not in use. I neither state or imply that SMART is sufficient, except in learning more about an error a user has already encountered. Such an error was the subject of this thread.



ThomasB2010 wrote:


Fifth, I think it's bad advice to essentially imply to people that a drive with potential problems is "OK." A drive with problems is a drive with problems. If all anyone has stored on it is games or other trivial data, so what? But what about people that have tax returns, critical financial data, or other important and critical information stored on their drives? What you're proposing is essentially is for people to essentially take a "crap shoot" with what might be exceptionally important information.


In my reply, I explain that 197 and 198 errors are a frequent result of interrupted or unstable power during a write operation. This is particularly prevelant on the types of low end drives included in some Mac models. I explain this condition, and I also explain that if the 197 and 198 errors are not rectified by overwrites, if they return repeatedly, or if SMART reports a different type of intolerance, the drive is not okay.


Pulling power is not likely to damage a drive, but it is guaranteed to interrupt a write in progress and that often causes incomplete block writes. Backing up a drive and restoring to a new drive is not a risk-free operation. To throw away every drive that fails to checksum a sector is to throw away a vast majority of good hardware and to take unnecessary additional risk.



ThomasB2010 wrote:


What you should be emphasizing is backups.


Yes, emphasizing backups is common sense. Hopefully it's something everybody here is already doing. It's also beyond the scope of the reply.


But sure. Please remember to exercise and take a multivitamin too.

Apr 20, 2014 12:19 PM in response to McGroarty

I'm the one that reported using Scannerz (or maybe I should say "pitched" it by mentioning it). I'm personally reasonably well versed in fsck and its family. I'm also well versed in observing people that think they know how to use it end up trashing an entire file system.


The main difference between Scannerz and fsck is that Scannerz doesn't assume an I/O error is a bad block. Faulty cables and other problems can generate the exact same error. If the I/O error was caused by a faulty cable, fsck could conceivably perform unnecessary operations on a perfectly good disk. Scannerz would detect the difference. fsck was never intended to be a test tool, but that's all Scannerz does.


If you have a faulty cable that's generating intermittent and/or erratic I/O errors because of periodic disconnects, fsck would be seeing these as drive faults and modifying the file system when it shouldn't be modified. What you will end up with is a potentially ruined file system.


If someone wants to test the integrity of a hard drive or system, the last thing they need is something that's going to start modifying the file system in that process.

Mar 11, 2016 3:04 PM in response to MrHoffman

I have 94 bad blocks ,I think it is the previous 10.8 file vault data can not be arased because the SMARTis verified and all tests are positive ,but calculations are bad 160 GB reads 149gb.Ispent a week erasing 10 times at 35 write over takes 2 days in between formatting and partitioning on different numbers using Techtool pro and deluxe disk utility taking out memory I did every known test and repair Apple said that it should be gone ,but it is encrypted and the writer can not read so can not write over.

Mar 11, 2016 4:05 PM in response to sheffi

I am sorry to say Apple but 13 years of struggle with 30 computers and 50 apple products and lots of money Ihave a mixed success and never done my job and not made bi lingual user interface no Ainu support no Siberian languages support no written explanation in dictionary of all code written to all OS X and iOS many things I thought could be possible with a PC all those false promises that Computing could solve all our problems.

Disk Utility: for bad blocks on hard disks, are seven overwrites any more effective than a single pass of zeros?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.