Solution: dd too slow on Mac OS X

When I was cloning SD cards on Mac OS X using dd', it takes ages to get things done. I was using the following command:

It takes much less time when using /dev/rdisk2 instead of /dev/disk2:

The reason is that rdisks are "raw" thus resulting in a higher R/W speed, according to man hdiutil` [1]:

/dev/rdisk nodes are character-special devices, but are “raw” in the BSD sense and force block-aligned I/O. They are closer to the physical disk than the buffer cache. /dev/disk nodes, on the other hand, are buffered block-special devices and are used primarily by the kernel’s filesystem code.

[1] http://superuser.com/questions/631592/mac-osx-why-is-dev-rdisk-20-times-faster-than-dev-disk

38 thoughts on “Solution: dd too slow on Mac OS X

  1. Pingback: Usar dd mas rapido en MacOS X para imágenes de Raspberry - Que he aprendido hasta ahora (QHAHA)

  2. Pingback: Speed up dd write speed on OSX | The NSCoder

  3. Pingback: 在Linux/Mac中使用「dd」指令燒錄 .ISO 鏡像至USB硬碟 | 暢想資源

  4. 3284139520 bytes transferred in 19705.137328 secs (166664 bytes/sec)

    vs

    3284139520 bytes transferred in 255.784407 secs (12839483 bytes/sec)

     

    Thanx! 🙂

  5. So I can keep my Mac and don’t throw it away! Thanks a LOT, x16 speed on a USB stick!

     

  6. Thanks a lot man!!! You saved my life!!!!

    I have a fast external disk that I want to backup to the local MAC disk and an USB 3.0 SATA adapter and got only 30 Mbytes/s.

    Now is 300Mbytes/s!!!!!

     

    Thanks!!!!

    Thanks!!!!

    Thanks!!!

  7. Thanks a lot !!
    Here with pv command to see the copy progress 😉
    dd bs=1m if=~/Downloads/20131009.alice.img | pv | sudo dd bs=1m of=/dev/rdisk2

  8. WOW, this made all the difference it the world!! add the pv command (not needed as much now due to how fast it is) and I can get back to work.

  9. Thanks a lot !!
    Here with pv command to see the copy progress ?
    dd bs=1m if=~/Downloads/20131009.alice.img | pv | sudo dd bs=1m of=/dev/rdisk2

    I’d use:
    sudo -s — “dd bs=1m if=imagefile.img | pv | dd bs=1m of=/dev/rdisk2”
    Because you have to run dd with root privileges.

  10. Pingback: Building Swift 3.0 on a Raspberry Pi 3

  11. Damn I read this too late, now I won’t kill the process because the whole image is “only” 3,3 GB:

    sudo killall -INFO dd

    2459+0 records in
    2458+0 records out
    2577399808 bytes transferred in 5596.141697 secs (460567 bytes/sec)

     

  12. Same for databases (like 50%+ faster running off raw devices) but rarely used there because there’s too high chance junior sysadmins / devs will confuse your database storage for empty disks 🙁

  13. Bonus: for those who use pv for getting a progress meter:
    Use dd from gnu coreutils (both macports and homebrew should have it) and then append

    to your command.

  14. Sorry for the newbie question, but I keep getting a “dd: /dev/rdisk5: Operation not permitted”  when I enter “sudo dd bs=1m if=/Users/me/Desktop/file.img of=/dev/rdisk5”  Not sure what I’m doing wrong.

  15. Nm, I just found out what I did wrong.  I realized that my sd card changed to disk6 instead of disk5.  Doh

  16. Pingback: 在树莓派 3 上构建 Swift 3.0-IT文库

Leave a Reply

Your email address will not be published.