13

I was writing to an SD card this evening from a Mac Book Air internal card reader, and the performance reported was 1.4 MB/sec. I later read tested it on the Raspberry Pi and got 20 MB/sec. It is a class 6 card and neither of these figures sound realistic!

I am using dd for my tests. Results of identical tests of both read and write on both computers:

Raspberry Pi: Read 20 MB/sec.  Write 11 MB/sec...
Air:                 Read   3 MB/sec.  Write  1.4 MB/sec

Using these commands:

Write test:

sudo dd if=/dev/zero of=/dev/mmcblk0p3 bs=1M count=400

Read test:

sudo dd of=/dev/null if=/dev/mmcblk0p3 bs=1M count=400

This indicates that the perceived anomaly was in fact lousy performance of the integrated Mac Book Air SD card reader! It makes for very slow image creation.

Peter Mortensen
  • 2,004
  • 2
  • 15
  • 18
ScrollerBlaster
  • 489
  • 1
  • 5
  • 12

4 Answers4

12

To get the best speed out of your MacBook's SD slot, you need to use a 'raw disk' device.

This is a SanDisk Ultra Class 10 card:

~/Desktop/rpi $ sudo dd if=2012-12-16-wheezy-raspbian.img of=/dev/disk1 bs=8m
231+1 records in
231+1 records out
1939865600 bytes transferred in 1076.078932 secs (1802717 bytes/sec)

Compare this to using /dev/rdisk1 instead of /dev/disk1

~/Desktop/rpi $ sudo dd if=2012-12-16-wheezy-raspbian.img of=/dev/rdisk1 bs=1m
1850+0 records in
1850+0 records out
1939865600 bytes transferred in 129.712100 secs (14955163 bytes/sec)

1.8MB/s compared to 14.9MB/s - almost 10x the improvement!

Bert
  • 862
  • 7
  • 10
6

SD card speed class rating specifies minimal read/write performance the card should have while recording video. Class number is the lower speed limit in MB/s you should get when using the card.

Keep in mind, however, that reading from card is usually much simpler (and thus faster) than writing. This is why usual class 6 card will have 6MB/s write speed by 15-20 MB/s read speed (but only 6MB/s is warranted).

Speed of reading/writing can be limited not only by a card but also by a lot of different factors, both hardware and software. Especially it can be limited by some problems with card reader/writer.

So in your situation, it seems that your card has really bad performance on your Mac Book Air while it has proper (and realistic) performance on RaspberryPi. We can't be sure, however, since you tested write speed on Mac Book and read speed on RaspberryPi and as I mentioned earlier, they are not comparable. It's also hard to comment on why you're getting such results since you didn't specify how are you testing those speeds.

Krzysztof Adamski
  • 9,605
  • 1
  • 38
  • 53
1

You can also use these commands for benchmarking without influence of cache that gets loaded into RAM:

read speed benchmark: $ sudo dd if=/dev/sdX1 of=/dev/zero bs=1M count=400 iflag=direct

write speed benchmark : $ sudo dd if=/dev/zero of=/dev/sdX1 bs=1M count=400 skip=1000 oflag=direct

Make sure to always use oflag=direct and iflag=direct when respectively doing write and read benchmark test, or you risk toi get results that actually are filecache write and read timings.

valentt
  • 1,315
  • 3
  • 15
  • 21
0

On my 2015 MBP running OSX 10.11.5, I received the following write speeds while using dd:

when writing to /dev/disk: 1.80 MB/s when writing to /dev/rdisk: 12.80 MB/s