2

I'm attempting to zero a disk on my Mac OS X machine. I'm going for complete zeros and unformatted, so I think of dd. Unfortunately the maximum throughput I've managed to get out of dd is 7MB/s. Just for grins I tried disk utility and it has a throughput of 19MB/s. What gives? I've tried changing the bs option on dd to all sorts of values, but it still hovers around 7MB/s. Why is disk utility so much faster?

jdizzle
  • 558
  • 3
  • 8

2 Answers2

4

That sounds pretty slow for dd, what was the infile you were using? I prefer dd to Disk Utility.app just because it's faster and I find it's easier to work with. The command you should use is:

dd if=/dev/zero of=/dev/[blockdevice] bs=1M

Jordan Eunson
  • 1,312
  • 9
  • 15
  • I used that exact command, but the throughput stayed at about 7MB/s while Disk Utility was roughly 3 times that. What gives?? – jdizzle May 20 '10 at 00:06
  • @jdizzle when using dd or similar software (eg. dd_rescue) that uses /dev/diskX naming scheme, on macOS is important to use /dev/rdiskX format (r means raw unbuffered access straight to the device). more details - https://superuser.com/a/892768/328636 – seven Jan 13 '21 at 23:10
  • Where can I learn `blockdevice` id? – alper May 02 '21 at 12:40
1

Disk utility may be faster because it writes to a raw disk. When using DD, try writing dd as a raw disk by putting an r infront if disk in /dev/disk. Therefore your dd command should look like the following:

dd if=/dev/zero of=/dev/rdiskX bs=16m

You may want to change the lowercase m after 16 to an uppercase M depending on if you are using dd with mac os or linux.

DanRan
  • 73
  • 1
  • 1
  • 12