I’ve been writing to SD cards a bit lately while mucking around with a Raspberry Pi and a few other boards. This involves using dd to write a disk image directly onto the SD card. Whenever I do this, it is very slow. I mean really slow. I began to suspect the OSX implementation of dd and tonight I tested it out.
Here is a write of an image (Fedora for a Cubieboard) on my mac
sudo dd if=~/Downloads/Fedora-18-a10-armhfp-r1-cubie.img of=/dev/disk8 bs=64k
49152+0 records in
49152+0 records out
3221225472 bytes transferred in 1625.948833 secs (1981136 bytes/sec)
I then started an Ubuntu VM on VMWare on the same mac and repeated the operation
sudo dd if=Desktop/Fedora-18-a10-armhfp-r1-cubie.img of=/dev/sdb bs=64k
49152+0 records in
49152+0 records out
3221225472 bytes (3.2 GB) copied, 365.608 s, 8.8 MB/s
So on the same hardware plus a VM, Ubuntu’s dd is about 5 times faster. I have no idea why but I’ll be using a VM to write my images from now on.
Try a greater block size, such as bs=1M
Thanks. I’ve tried all sorts of block sizes to minimal effect.
Use /dev/rdisk1 instead of /dev/disk1
This makes all the difference. I saw speeds go up from 0.3 MB/s to 20 MB/s.
Use sudo dd if=~/Downloads/Fedora-18-a10-armhfp-r1-cubie.img of=/dev/rdisk8 bs=64k
Use /dev/rdiskN (raw) on Mac OS X as it will be orders of magnitude faster than using /dev/diskN .
Cheers,
Marcus
I was having a terrible time trying to copy a large image to a USB stick using dd in OSX (Yosemite). After a few attempts with various different options, I decided to see if I could download, install and configure VirtualBox and Ubuntu and get it to the point where I could do the above before the native OSX dd could finish. After about an hour of letting it copy a 3.9GB file, I had my new Ubuntu VM running. The dd in the native OSX was still running. I canceled it to discover that I was only getting around 200kb/sec. Ridiculous.
I retried it in Ubuntu – a VM inside the native machine – and I’m getting 6MB/s!! Still not breaking any records for USB writing, but it’s still THIRTY (30!) times faster than through the native OSX.
WTF, Apple?
Thanks for this. This is the way I’m going to do this from now on…
As was said before: use of=/dev/rdisk and NOT of=/dev/disk on OS X because rdisk is much, much faster (usually as fast as the device is able to write).
No need to go to Linux, just add the “r” in front of disk for your output!
Thank you Wouter! rdiskX works so much better!
I use of=/dev/rdiskN and it does not help. It tool about 3-4hrs to make a 4.63GB Red Hat usb stick !
Running into the same issue on a 2014 mbp with a Realtek USB 3.0 sd card reader.
/dev/rdisk* and /dev/disk* make no difference, write speeds are around 300-400Kb/s where I get around 10Mb/s on ubuntu with the same sdcard and reader.