Originally Posted By: artie505

Copy and paste this into a Terminal window:

Code:
sudo dd if=/dev/rdisk0 of=/dev/null conv=noerror

Hit return, enter your password at the prompt (it will not be visible), and be prepared to wait "n" hours for the command to run its course, depending on how fast your MBP runs, how large your HDD is, and whether it runs at 5,400 or 7,200RPM.

The command runs in the background, so you don't have to quit working while it's doing its thing, and I again urge you to not be lazy! If the original I/O errors can be relied on (Edit: And there's absolutely no reason to believe they were spurious.), your HDD is liable to tank at any moment...most likely the worst one. tongue


I'll make an adjustment to that. DD runs VERY slowly 512 bytes per pass. Bump that up by increasing block size. OK to use any larger number, but keep it an even multiple of 512. I use 1024000 for approximately 1mb. (performance levels off when you reach about 250k) 512 vs 1024000 can be the difference between three days and two hours.

sudo dd if=/dev/rdisk0 of=/dev/null bs=1024000

you can leave conv=noerror on there if you want it to find all the bad blocks instead of stopping at the first one. but I'm a zero-tolerance-policy on io errors. One sends it to my trashcan or RMA box.

sudo dd if=/dev/rdisk0 of=/dev/null bs=1024000 conv=noerror

(you also correctly chose rdisk. some people use disk instead, and for some reason no one can explain, DD accesses character devices much faster than block devices)


Code:
mac-e1:~ root # dd if=/dev/rdisk0 bs=512 count=512000 of=/dev/null
512000+0 records in
512000+0 records out
262144000 bytes transferred in 18.989955 secs (13804351 bytes/sec)

mac-e1:~ root # dd if=/dev/rdisk0 bs=512000 count=512 of=/dev/null
512+0 records in
512+0 records out
262144000 bytes transferred in 0.395372 secs (663031416 bytes/sec)

mac-e1:~ root # dd if=/dev/disk0 bs=512000 count=512 of=/dev/null
512+0 records in
512+0 records out
262144000 bytes transferred in 2.552634 secs (102695490 bytes/sec)

13 / 663 / 102 MB/sec... the details really do make a big difference o_O
oops, this is on an iMac with an SSD, that's not what I was intending to test. let me do another...


Code:
MACLT:~ root # dd if=/dev/rdisk0 bs=512 count=512000 of=/dev/null
512000+0 records in
512000+0 records out
262144000 bytes transferred in 21.312791 secs (12299844 bytes/sec)

MACLT:~ root # dd if=/dev/rdisk0 bs=512000 count=512 of=/dev/null
512+0 records in
512+0 records out
262144000 bytes transferred in 0.439098 secs (597005841 bytes/sec)

MACLT:~ root # dd if=/dev/disk0 bs=512000 count=512 of=/dev/null
512+0 records in
512+0 records out
262144000 bytes transferred in 2.674647 secs (98010687 bytes/sec)

12 / 597 / 98 - this is on a retina SSD


Code:
mac-scan:~ root # dd if=/dev/rdisk0 bs=512 count=512000 of=/dev/null
512000+0 records in
512000+0 records out
262144000 bytes transferred in 75.715733 secs (3462213 bytes/sec)

mac-scan:~ root # dd if=/dev/rdisk0 bs=512000 count=512 of=/dev/null
512+0 records in
512+0 records out
262144000 bytes transferred in 2.251195 secs (116446601 bytes/sec)

mac-scan:~ root # dd if=/dev/disk0 bs=512000 count=512 of=/dev/null
512+0 records in
512+0 records out
262144000 bytes transferred in 7.251505 secs (36150289 bytes/sec)

3 / 116 / 36 THAT is more what I was expecting to see. 3 vs 116 for block size problem, 116 vs 36 for char/block device problem. But yeah... 3 MB/sec vs 116.



Curious to see the SSD suffers from the same blocksize/devtype issues with DD.


I work for the Department of Redundancy Department