Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

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 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. I hope to revert soon with read and write tests on both the Air and the PI.

UPDATE:

Results of identical tests of both read and write on both computers.

PI: read 20MB write 11MB.... AIR: read 3MB write 1.4MB

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! Makes for very slow image creation.

share|improve this question
    
Sandisk claims that class 6 cards have a read speed of 20MBps, although Kingston claims 15MBps is the read speed for class 6 cards. I don't know if the Mac Book has an integrated SD card reader or not. But for external (USB 2.0) versions the quality of the SD card reader (what chips used etc) is also of importance of the overall performance. But reading always is faster with these devices then writing. –  ikku Oct 15 '12 at 23:31
    
Thanks. It is integrated. Pretty good read performance. Really bad write performance. –  ScrollerBlaster Oct 16 '12 at 6:37
add comment

3 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
I need to test read and write on both platforms. I'm using dd –  ScrollerBlaster Oct 16 '12 at 8:49
    
@ScrollerBlaster: You can't compare read to write speed against each other. Similar, when testing just about anything, a good rule of thumb is to change only one thing at a time. But you changed everything (OS, host computer, card reader) but one thing (sd card) in your setup, so that won't give you meaningful results. –  Krzysztof Adamski Oct 16 '12 at 9:16
    
I have said I will compare read vs write on the same OS. Do you have a problem with that approach? –  ScrollerBlaster Oct 16 '12 at 9:17
    
@ScrollerBlaster: No, not at all. I just wanted to be clear on what I mean by saying they are not comparable in my answer. Remember that this answer is not only for you but for all the other people that may have similar problem in future so I try to make my advice as generic as possible. –  Krzysztof Adamski Oct 16 '12 at 9:29
    
When you pointed out in your post that my test was not comparing apples and oranges, this was a very valid point. In my 1st comment I stated I would redo the test, meaning I would redo read and write on both platforms. Thereafter your subsequent advice to me was unnecessary. Going forward, any conclusions about Air versus PI are still premature. The most relevant test will be a read vs write test on the PI, given that this is a PI forum. If you have dd commands to do a safe write test I will use them! –  ScrollerBlaster Oct 16 '12 at 10:05
show 3 more comments

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!

share|improve this answer
    
what is difference between disk and rdisk ? –  valentt Dec 31 '12 at 8:44
    
"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." - Check the hidutil man page for more information. –  Bert Dec 31 '12 at 18:02
1  
This is potentially misleading since the block size changed between the two tests. –  Nick Aug 10 '13 at 12:53
    
FWIW: I changed the block size to 1m and the device /dev/rdisk1 and my write speed went from ~1.75MB/sec to ~11.4MB/sec with a class 10 card. –  Gardner Bickford Feb 11 at 6:54
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.