osx - dd performance on Mac OS X vs. Linux

06
2014-04
  • charliehorse55

    I was trying to copy an iso of the windows installer onto a hard drive to avoid burning a disk. I first tried Disk Utility's restore function, however it didn't like the ISO for some reason. Then I tried using dd:

    dd if=/path/to/image.iso of=/dev/disk3
    

    I realized it was copying the file at a snail's pace, about 160 KB/sec. I rebooted into my linux installation and ran the command again, almost verbatim:

    dd if=/path/to/image.iso of=/dev/sdc
    

    This time the command executed in under a minute, with an average speed of 57 MB/sec. In both cases the source and destination were the same physical hard drives. What's going on?

    I am running OSX 10.7.3 and Linux 2.6.38-13.

  • Answers
  • slhck

    For OS X, use /dev/rdisk3.

    For some reason rdisk is faster than disk. I believe it has to do with buffers.

    Also in general using the bs flag with dd helps with speed.

    dd if=/path/to/image.iso of=/dev/sdc bs=1M
    

    The bytesize is 1M which transfers faster. On OS X you have to use 1m (lowercase) instead of 1M.


  • Related Question

    linux - Harddisk formatting with dd return error
  • usajbalt

    I tried to format my harddisk (160 GB) with the following command

    dd   if=/dev/zero   of=/dev/sda
    

    After some 3 hours, following error came up:

    dd: writing to '/dev/sda' : No space left on device 
    312581809+0 records in 
    312581808+0 records out 
    160041885696 bytes (160 GB) copied, 10708.3 s, 14.9 MB/s
    

    Any idea what went wrong?


  • Related Answers
  • Journeyman Geek

    well, if you wanted to wipe a disk 'shred' is the proper command. You'd then want to create partitions with fdisk, and use some variety of mk__fs (mke2fs etc) or parted to make a file system in the partition.

  • Hugh Allen

    /dev/zero is in principle infinite. /dev/sda is not.