Checking for bad blocks without formatting

My Mac tends to pause every now then when preforming simple tasks such as right clicking, opening menus and typing (It actually just froze when I started typing this question.).

I've read in a few places that this may be due to bad disk blocks, and that the best way to fix this is to format and overwrite the whole disk with zeroes. Obviously, this takes time and will destroy any data I have on the disk. Is there a way to check for bad blocks without formatting the drive, or even remap the disk to ignore those blocks (ultimately fixing it)?

My Mac is pretty recent (Mac Mini late 2011), so I doubt it has anything to do with low memory or swappage.


Solution 1:

I'll answer the "bad blocks" tack and you can ask a follow on question if you still have slowness and you have concluded that it's not simply bad blocks. (Bad blocks is almost never a slow issue - since the system can remap blocks so rapidly, that you'd need rafts and rafts of them to actually impair I/O. If you do have bad blocks, they can corrupt some of the data on the drive and a reinstall not only fixes that, it forces writes to detect more bad blocks - kind of a win/win situation).

You need no extra tools to see the health of your drive.

Open Disk Utility and select the physical drive itself (not the Macintosh HD or whatever the partition/volume is) and select info.

Disk Utility Info

If you record and watch the values under S.M.A.R.T. Status and see how they change over time, you can know pretty much anything that is detectable about storage degradation or partial failure.

Solution 2:

If we separate the essence of the question, from the reasons for asking …

Start Ubuntu and run badblocks

Use an Ubuntu disc that works with your Mac, then run badblocks with appropriate options.

Ubuntu Manpage: badblocks - search a device for bad blocks

… click the heading for the full answer.

Elsewhere in Stack Exchange

How to check whether there is bad sector on a USB harddisk on OS X? (2012-02-27)

  • links to another related question.

More recently, in Ask Different:

  • Figuring out bad sectors in my Macintosh HD (2013-03-05)

Whatever you use

Be aware that relocation (or remapping or sparing, or whatever you call it) may cause dataloss

  • DriveGenius 3 offers an unmistakable warning that may be not offered by other utilities.

Solution 3:

I recommend Disk Warrior or Drive Genius, both of which should offer the option to boot from external media in order to analyze your hard drive.

Solution 4:

"Please: if you can't name a product, can you describe its method of testing?"

I can't blame him for not naming a tool. I have no idea where you live but in the U.S. companies can sue you for criticizing them.

However, based on his experiences with a "famous tool" I would suspect it's initials are TTP.

From what I can tell, that product doesn't seem to do a very thorough job of doing anything. I've read reports that all it was doing was a raw read of a hard drive and flagging I/O errors as sector problems whenever it felt like it. It misses drive problems. I've seen this first hand, and it costs $100.

I've never used Drive Genius so I don't know anything about it. I can, however, speak of both Spinrite and Scannerz.

Spinrite uses what I consider, at least in its re-write mode, a very, very risky procedures. It attempts to read and then re-write a sector to a drive. This is OK if the source of the problems is actually a sector failure, but intermittent cable failures can cause the exact same problem. In other words, if an intermittent cable failure corrupts data transfer between the CPU and hard drive, it could very well end up first reading corrupted data from a hard drive and then re-writing it over good data. The potential for corruption in such a case is high. Spinrite is an ancient product developed for PC's back in the early '80s.

Scannerz actually isn't actually hard drive testing software, it's fault detection software. It monitors for I/O errors and timing irregularities, and it appears to do so based on a statistical model of the drive/system performance. The "rule" with Scannerz is that if a problem is repeatable from scan to scan then the problem is with the media itself, and it will be either a bad sector or a weak sector. If the problem isn't repeatable on a scan, then it's likely another fault such as a bad cable or cracked trace in the logic board. Scannerz has an overwrite mode, but their manuals warn about using it quite heavily, as does the product which will throw out an a warning dialog about using it. Most if not all of the procedures they use for correcting problems are done using standard tools such as Disk Utility. I could teach my dog to do a basic scan on a drive with Scannerz, however to utilize it to its fullest potential requires at least a moderate amount of knowledge as to how a system works.

I have personally witnessed Scannerz picking up bad cables on an external hard hard drive. You can actually fool with a cable during a scan and watch irregularities and errors crop up as the faulty cable is moved around. To the best of my knowledge, no other tool on the market can detect that.

With all that said, regarding other tools, the idea of using an old MS-DOS based tool such as Spinrite or something from a Linux distribution is likely impractical for most Mac users. I would be willing to bet most Mac users aren't even sure what Linux is, and they often likely don't know (or want to know) how to specifically isolate a drive so a product with its origins in MS-DOS can work, and potentially damage their drive. Such tactics may be OK with hard core techies, but they're utterly impractical for most people. I would also add that applications that appear to be doing little more than exec'ing system calls to the command line version of Disk Utility aren't terribly impressive, IMHO.

Solution 5:

Use disk utility to find out the device name (e.g. "disk4") then in a Terminal window try

sudo dd bs=1m if=/dev/disk4 of=/dev/null

This will try to read the entire drive contents.