Showing posts with label HDD. Show all posts
Showing posts with label HDD. Show all posts

Wednesday, 12 November 2014

Banana Pi SATA 2.0 disk throughput test

Hardware Configuration:

Banana Pi-M1 1024MiB RAM, no overclocking
Inbuilt 10/100/1000 NIC is connected.
Top USB port is empty.
Bottom USB port is empty.
SATA disk connected via SATA cable to SATA port on BPi.
Harddisk is power from an external supply (R-Driver III).
No keyboard and no mouse.

The HDD that I'm using has an Internal write rate of about 100MiB/sec, so it is not a great disk for SATA performance testing, but it is the same make and model that I used for testing the Raspberry Pi USB disk throughput test.

 

Prerequisites:

apt-get install dosfstools
apt-get install expect expect-dev tcl8.6 tk8.6



ext2, ext3, ext4, vfat file system write tests 


I split a 2 TB disk into four equal sized partitions.

root@bananapi ~ # fdisk -l /dev/sda

Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x5d3d4ef6

Device     Boot      Start        End   Sectors   Size Id Type
/dev/sda1             2048  976758783 976756736 465.8G 83 Linux
/dev/sda2        976758784 1953515519 976756736 465.8G 83 Linux
/dev/sda3       1953515520 2930272255 976756736 465.8G 83 Linux
/dev/sda4       2930272256 3907028991 976756736 465.8G  c W95 FAT32 (LBA)

root@bananapi ~ # mkfs.ext2 -L ext2 /dev/sda1
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 122094592 4k blocks and 30531584 inodes
Filesystem UUID: 35d529af-5e67-4f17-8c78-5af67a4f85f8
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

mkfs.ext2 -L ext2 /dev/sda1  0.65s user 31.41s system 12% cpu 4:18.17 total
root@bananapi ~ # mkfs.ext3 -L ext3 /dev/sda2
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 122094592 4k blocks and 30531584 inodes
Filesystem UUID: d0fe6f90-cc02-4d98-ba62-a704692edaf3
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

mkfs.ext3 -L ext2 /dev/sda2  0.81s user 33.67s system 13% cpu 4:20.11 total
root@bananapi ~ # mkfs.ext4 -L ext4 /dev/sda3
mke2fs 1.42.12 (29-Aug-2014)
Creating filesystem with 122094592 4k blocks and 30531584 inodes
Filesystem UUID: 02029d9e-70e3-4012-a217-fff6754fe0b8
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

root@bananapi ~ # mkfs.vfat -n VFAT /dev/sda4
mkfs.fat 3.0.26 (2014-03-07)
root@bananapi ~ # cd /media
root@bananapi /media # mkdir ext2 ext3 ext4 vfat
root@bananapi /media # cd
 






root@bananapi ~ # cat write-throughputtest.exp
#!/usr/bin/expect -f

set force_conservative 0  ;# set to 1 to force conservative mode even if
                          ;# script wasn't run conservatively originally
if {$force_conservative} {
        set send_slow {1 .1}
        proc send {ignore arg} {
                sleep .1
                exp_send -s -- $arg
        }
}


set timeout -1
spawn $env(SHELL)
match_max 100000
expect "root@bananapi"
send -- "script /root/output.txt\r"
expect "Script started, file is /root/output.txt\r"
send -- "mount /dev/sda1 /media/ext2\r"
expect "root@bananapi"
send -- "mount /dev/sda2 /media/ext3\r"
expect "root@bananapi"
send -- "mount /dev/sda3 /media/ext4\r"
expect "root@bananapi"
send -- "mount /dev/sda4 /media/vfat\r"
expect "root@bananapi"
send -- "/root/write-throughputtest.sh /media/ext2\r"
expect "root@bananapi"
send -- "/root/write-throughputtest.sh /media/ext3\r"
expect "root@bananapi"
send -- "/root/write-throughputtest.sh /media/ext4\r"
expect "root@bananapi"
send -- "/root/write-throughputtest.sh /media/vfat\r"
expect "root@bananapi"
send -- "exit\r"
expect "Script done, file is /root/output.txt\r"
send -- "exit\r"
expect eof
root@bananapi ~ #










root@bananapi ~ # cat write-throughputtest.sh
#!/bin/sh
DEST=$1

# 18 x 1GiB = 18GiB
# assuming maximum write SATA2 286MiB/sec this should take more than a minute
# assuming poor write speed of 5 MiB/sec this should take more than a hour
# either way one pass should happen within 12 hours
echo touch $DEST/testbegin-write-starttime
touch $DEST/testbegin-write-starttime
date
echo sync
sync
date

for BS in 8 16 32 64 128 256 \
        512 1024 2048 4096 8192 16384 \
        32768 65536 131072 262144 524288 1048576

do
 COUNT=`expr 1073741824 / $BS`
echo touch $DEST/${BS}b-write-starttime
 touch $DEST/${BS}b-write-starttime
date
echo dd if=/dev/zero of=$DEST/${BS}b-data bs=${BS} count=${COUNT}
 dd if=/dev/zero of=$DEST/${BS}b-data bs=${BS} count=${COUNT}
date
echo touch $DEST/${BS}b-write-endtime
 touch $DEST/${BS}b-write-endtime
date
echo sync
 sync
date
# any delay caused by sync will show up on next starttime
done

echo touch $DEST/testover-write-endtime
touch $DEST/testover-write-endtime
date

root@bananapi ~ #











root@bananapi ~ # cat read-throughputtest.sh
#!/bin/sh

SRCE=$1


# 18 x 1GiB = 18GiB
# assuming maximum read SATA2 286MB/sec this whould take just over a minute
# assuming poor read speed of 5 MiB/sec this should take just over a hour
# This script assumes that write-throughputtest.sh was run
# previously to generate the data files.

date
echo sync
sync
date

for BS in 8 16 32 64 128 256 \
        512 1024 2048 4096 8192 16384 \
        32768 65536 131072 262144 524288 1048576
do
 COUNT=`expr 1073741824 / $BS`
date

echo dd of=/dev/null if=$SRCE/${BS}b-data bs=${BS} count=${COUNT}
 dd of=/dev/null if=$SRCE/${BS}b-data bs=${BS} count=${COUNT}
date
echo sync
 sync
date
done


date
root@bananapi ~ #





I'm converting the results so that I can display them in MiB/sec instead of dd's default of MB/sec. Because I'm copying a Gigabyte of data with each block size all I need to do is divide 1024 by the number of seconds that it took to get the result in MiB/second.



root@bananapi ~ # grep bytes output.txt | grep copied | head -18
1073741824 bytes (1.1 GB) copied, 775.481 s, 1.4 MB/s
1073741824 bytes (1.1 GB) copied, 428.811 s, 2.5 MB/s
1073741824 bytes (1.1 GB) copied, 222.595 s, 4.8 MB/s
1073741824 bytes (1.1 GB) copied, 115.167 s, 9.3 MB/s
1073741824 bytes (1.1 GB) copied, 67.9903 s, 15.8 MB/s
1073741824 bytes (1.1 GB) copied, 43.2929 s, 24.8 MB/s
1073741824 bytes (1.1 GB) copied, 28.109 s, 38.2 MB/s
1073741824 bytes (1.1 GB) copied, 24.2247 s, 44.3 MB/s
1073741824 bytes (1.1 GB) copied, 23.847 s, 45.0 MB/s
1073741824 bytes (1.1 GB) copied, 23.8354 s, 45.0 MB/s
1073741824 bytes (1.1 GB) copied, 23.7234 s, 45.3 MB/s
1073741824 bytes (1.1 GB) copied, 23.8386 s, 45.0 MB/s
1073741824 bytes (1.1 GB) copied, 23.6681 s, 45.4 MB/s
1073741824 bytes (1.1 GB) copied, 24.1159 s, 44.5 MB/s
1073741824 bytes (1.1 GB) copied, 24.3767 s, 44.0 MB/s
1073741824 bytes (1.1 GB) copied, 24.477 s, 43.9 MB/s
1073741824 bytes (1.1 GB) copied, 24.8436 s, 43.2 MB/s
1073741824 bytes (1.1 GB) copied, 24.3786 s, 44.0 MB/s
root@bananapi ~ # grep bytes output.txt | grep copied |  awk '{printf "%3.1f\n", 1024/$6}' | head -18
1.3
2.4
4.6
8.9
15.1
23.7
36.4
42.3
42.9
43.0
43.2
43.0
43.3
42.5
42.0
41.8
41.2
42.0
root@bananapi ~ #


 Results

SATA disk performance check on Banana Pi SATA port.


Banana Pi SATA disk write results (spinning rust)
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------            
(bytes)ext2       ext3       ext4       vfat
8       1.3 MiB/s  0.6 MiB/s  0.6 MiB/s  1.1 MiB/s
16      2.4 MiB/s  1.1 MiB/s  1.1 MiB/s  2.1 MiB/s
32      4.6 MiB/s  2.1 MiB/s  2.1 MiB/s  3.9 MiB/s
64      8.9 MiB/s  4.0 MiB/s  4.1 MiB/s  7.3 MiB/s
128    15.1 MiB/s  7.6 MiB/s  7.9 MiB/s 11.9 MiB/s
256    23.7 MiB/s 13.0 MiB/s 12.5 MiB/s 16.7 MiB/s
512    36.4 MiB/s 21.3 MiB/s 23.2 MiB/s 23.0 MiB/s
1k     42.3 MiB/s 30.9 MiB/s 36.0 MiB/s 26.4 MiB/s
2k     42.9 MiB/s 36.2 MiB/s 43.8 MiB/s 28.7 MiB/s
4k     43.0 MiB/s 40.3 MiB/s 44.5 MiB/s 29.7 MiB/s
8k     43.2 MiB/s 41.0 MiB/s 44.2 MiB/s 30.6 MiB/s
16k    43.0 MiB/s 40.6 MiB/s 44.0 MiB/s 31.0 MiB/s
32k    43.3 MiB/s
37.5 MiB/s 44.0 MiB/s 30.2 MiB/s
64k    42.5 MiB/s 39.9 MiB/s 43.4 MiB/s 30.4 MiB/s
128k   42.0 MiB/s 39.9 MiB/s 42.3 MiB/s 30.1 MiB/s
256k   41.8 MiB/s 39.1 MiB/s 43.3 MiB/s 29.8 MiB/s
512k   41.2 MiB/s 38.9 MiB/s 43.0 MiB/s 30.6 MiB/s

1M     42.0
MiB/s 39.6 MiB/s 43.5 MiB/s 30.0 MiB/s


Banana Pi SATA disk read results (spinning rust)
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------           
(bytes)ext2       ext3       ext4       vfat
8        2.1MiB/s   2.1MiB/s   2.0MiB/s   2.0MiB/s
16       4.0MiB/s   4.1MiB/s   4.1MiB/s   4.0MiB/s
32       8.7MiB/s   8.6MiB/s  
8.5MiB/s   8.6MiB/s
64     
17.0MiB/s  16.9MiB/s  17.0MiB/s  16.9MiB/s
128     31.3MiB/s  31.2MiB/s 
31.5MiB/s  30.5MiB/s
256     54.8MiB/s  54.2MiB/s 
55.1MiB/s  52.4MiB/s
512     84.6MiB/s 100.4MiB/s 
83.9MiB/s  72.8MiB/s
1k     108.7MiB/s
100.4MiB/s  86.5MiB/s  74.2MiB/s
2k     107.7MiB/s  99.6
MiB/s  87.2MiB/s  73.8MiB/s
4k     109.7MiB/s 100.4
MiB/s  86.3MiB/s  72.6MiB/s
8k     109.7MiB/s 100.8
MiB/s  87.7MiB/s  73.1MiB/s
16k    109.8MiB/s
100.4MiB/s  86.6MiB/s  74.1MiB/s
32k    108.8MiB/s  98.0
MiB/s  87.6MiB/s  73.5MiB/s
64k    109.2MiB/s 100.4
MiB/s  86.0MiB/s  72.7MiB/s
128k   109.3MiB/s
100.7MiB/s  85.7MiB/s  73.2MiB/s
256k   108.7MiB/s
100.5MiB/s  86.8MiB/s  74.1MiB/s
512k   108.9MiB/s 
99.6MiB/s  88.1MiB/s  73.3MiB/s
1M     109.1MiB/s  99.2MiB/s 
86.7MiB/s  72.9MiB/s




I decided to run the tests again with an old 128GB SSD (write performance will be OKish because it is used, but read performance should be better than spinning rust). But to avoid killing it (small writes cause SSD's to fail prematurely) I started the write testing at 4K block size.The read test block size does not matter at all, SSD's always fail due to running out of writes (3000-5000 per block) long before any wear due to reads can happen. The reason I ran the tests again with a SSD was because I felt that the limiting factor was the Harddisk's poor read/write performance and not any limit of the Banana Pi's SATA 2.0 port.











Banana Pi SATA disk write results (SSD)
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------            
(bytes)ext2       ext3       ext4       vfat
4k     44.9 MiB/s 40.0 MiB/s 42.5 MiB/s 29.0 MiB/s
8k     45.3 MiB/s 41.0 MiB/s 42.5 MiB/s 29.8 MiB/s
16k    44.2 MiB/s 41.0 MiB/s 42.7 MiB/s 29.5 MiB/s
32k    43.9 MiB/s
41.7 MiB/s 42.4 MiB/s 29.3 MiB/s
64k    43.6 MiB/s 40.4 MiB/s 41.9 MiB/s 29.0 MiB/s
128k   42.5 MiB/s 39.5 MiB/s 42.1 MiB/s 28.3 MiB/s
256k   42.6 MiB/s 39.9 MiB/s 41.7 MiB/s 28.9 MiB/s
512k   43.8 MiB/s 39.7 MiB/s 
43.0 MiB/s 30.9 MiB/s
1M     43.7
MiB/s 40.3 MiB/s 41.7 MiB/s 32.0 MiB/s

Banana Pi SATA disk read results (SSD)
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------           
(bytes)ext2       ext3       ext4       vfat
8        2.0MiB/s   2.0MiB/s   2.1MiB/s   2.1MiB/s
16       4.2MiB/s   4.2MiB/s   4.2MiB/s   4.2MiB/s
32       9.0MiB/s   8.9MiB/s  
9.1MiB/s   8.9MiB/s
64     
17.2MiB/s  17.1MiB/s  17.0MiB/s  17.0MiB/s
128     31.4MiB/s  31.6MiB/s 
31.5MiB/s  31.1MiB/s
256     53.7MiB/s  54.7MiB/s 
55.0MiB/s  55.0MiB/s
512     83.6MiB/s  85.8MiB/s 
86.6MiB/s  85.8MiB/s
1k     115.6MiB/s
126.0MiB/s 123.6MiB/s 121.9MiB/s
2k     139.4MiB/s 1
51.5MiB/s 154.0MiB/s 152.5MiB/s
4k     160.3MiB/s 181.1
MiB/s 175.1MiB/s 180.8MiB/s
8k     185.1MiB/s 1
86.0MiB/s 180.4MiB/s 183.9MiB/s
16k    182.8MiB/s
183.9MiB/s 176.4MiB/s 184.5MiB/s
32k    173.2MiB/s 161.3
MiB/s 168.8MiB/s 171.2MiB/s
64k    163.0MiB/s 151.4
MiB/s 158.6MiB/s 161.3MiB/s
128k   159.0MiB/s
147.2MiB/s 154.0MiB/s 156.5MiB/s
256k   156.0MiB/s
147.3MiB/s 152.0MiB/s 155.4MiB/s
512k   156.6MiB/s
145.2MiB/s 153.0MiB/s 156.3MiB/s
1M     157.9MiB/s 148.1MiB/s
154.8MiB/s 156.4MiB/s


Since the throughput is more than 150MB/sec, it does confirm that the SATA port in the Banana Pi is SATA 2.0. And I suspect that it could get closer to the SATA 2.0 limit of 300MB/sec if I used a brand new SSD. I have to admit that I am so much more impressed by a Banana Pi especially when compared to a Raspberry Pi. Especially for pushing large amounts of data about fast, it is brilliant hardware.

Sunday, 30 March 2014

Raspberry Pi USB disk throughput test

Update (2015-02): There will be little to no change in throughput performance from the new Raspberry Pi Generation 2 Model B (900MHz quad-core ARM Cortex-A7 BCM2836) over the older Raspberry Pi Model B+ (700MHz ARM11 BCM2835), since the USB performance bottleneck is still the LAN9514 USB/Ethernet controller and will not be improved by additional CPU or RAM.

Update (2014-07): There is a new RPi model B+ with 4 USB ports (well 5 in fact when you include ethernet using a LAN9514 chip instead of 3 ports using the LAN9512 in the model B). Just to be clear the tests below were done on the model B. If and when I repeat the the tests with a model B+ I do not expect to see better performance.


Hardware Configuration:

Raspberry Pi model B - 512MB model, 128MB of RAM allocated to GPU, no overclocking
Inbuilt 10/100 NIC is connected.
Top USB port is a 2TB USB hard disk drive.
Bottom USB port is empty.

So no keyboard, no mouse. In an ideal world we would have the inbuilt USB NIC disabled (after setting the date and time) as well, but it appears that the RPi has the network module compiled directly into the kernel.
pi@raspberrypi ~ $ zgrep -i smsc95xx /proc/config.gz
CONFIG_USB_NET_SMSC95XX=y
pi@raspberrypi ~ $ sudo modprobe -r smsc95xx
FATAL: Module smsc95xx is builtin.

So to just have a hard disk  and RPi (and internal 3 port USB hub) would require me to recompile the kernel, which would make the results slightly off standard

The HDD that I'm using has an Internal write rate of about 100MiB/sec, so USB throughput should be the cause of any performance bottleneck.

 

Prerequisites:

sudo apt-get install at expect expect-dev



ext2, ext3, ext4, vfat file system write tests 


I split a 2 TB disk into four equal sized partitions.

pi@raspberrypi ~ $ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/3p, 480M
        |__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M
        |__ Port 2: Dev 4, If 0, Class=stor., Driver=usb-storage, 480M

pi@raspberrypi ~ $ sudo fdisk -l /dev/sda

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1ba9000c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   976758827   488378390   83  Linux
/dev/sda2       976758828  1953515607   488378390   83  Linux
/dev/sda3      1953515608  2930272387   488378390   83  Linux
/dev/sda4      2930272388  3907029167   488378390    c  W95 FAT32 (LBA)


pi@raspberrypi ~ $ sudo mkfs.ext2 -L ext2 /dev/sda1

pi@raspberrypi ~ $ sudo mkfs.ext3 -L ext3 /dev/sda2
pi@raspberrypi ~ $ sudo mkfs.ext4 -L ext4 /dev/sda3
pi@raspberrypi ~ $ sudo mkfs.vfat -n vfat /dev/sda4
pi@raspberrypi ~ $ cd /media 
pi@raspberrypi /media $ sudo mkdir ext2 ext3 ext4 vfat




pi@raspberrypi ~ $ at midnight

warning: commands will be executed using /bin/sh
at> /home/pi/write-throughputtest.exp 2>&1 >/home/pi/at.output 
at> ^D




pi@raspberrypi ~ $

 


pi@raspberrypi ~ $ cat write-throughputtest.exp
#!/usr/bin/expect -f
#
# This Expect script was generated by autoexpect on Sun Mar 30 16:43:25 2014
set force_conservative 0  ;# set to 1 to force conservative mode even if
                          ;# script wasn't run conservatively originally
if {$force_conservative} {
        set send_slow {1 .1}
        proc send {ignore arg} {
                sleep .1
                exp_send -s -- $arg
        }
}



set timeout -1
spawn $env(SHELL)
match_max 100000

expect "$"
send -- "/bin/bash"
expect "pi@raspberrypi"
send -- "sudo /bin//bash\r"
expect "root@raspberrypi"
send -- "script /home/pi/output-root.txt\r"
expect "Script started, file is /home/pi/output-root.txt\r"
send -- "mount /dev/sda1 /media/ext2\r"
expect "root@raspberrypi"
send -- "mount /dev/sda2 /media/ext3\r"
expect "root@raspberry
pi"
send -- "mount /dev/sda3 /media/ext4\r"
expect "root@raspberry
pi"
send -- "mount /dev/sda4 /media/vfat\r"
expect "root@raspberry
pi"
send -- "/home/pi/write-throughputtest.sh /media/ext2\r"
expect "root@raspberry
pi"
send -- "/home/pi/
write-throughputtest.sh /media/ext3\r"
expect "root@raspberry
pi"
send -- "/home/pi/
write-throughputtest.sh /media/ext4\r"
expect "root@raspberry
pi"
send -- "/home/pi/
write-throughputtest.sh /media/vfat\r"
expect "root@raspberry
pi"
send -- "exit\r"
expect "Script done, file is /home/pi/output-root.txt\r"
send -- "exit\r"
expect "pi@raspberry
pi"
send -- "exit\r"

expect "$"
send -- "exit\r"
expect eof
 


pi@raspberrypi ~ $ cat write-throughputtest.sh
#!/bin/sh
DEST=$1

# 18 x 1GiB = 18GiB
# assuming maximum write 40MiB/sec this should take 8 minutes
# assuming poor write speed of 5 MiB/sec this should take 2 hours
# either way one pass should happen within 12 hours
echo touch $DEST/testbegin-write-starttime
touch $DEST/testbegin-write-starttime
date
echo sync
sync
date

for BS in 8 16 32 64 128 256 \
        512 1024 2048 4096 8192 16384 \
        32768 65536 131072 262144 524288 1048576

do
 COUNT=`expr 1073741824 / $BS`
echo touch $DEST/${BS}b-write-starttime
 touch $DEST/${BS}b-write-starttime
date
echo dd if=/dev/zero of=$DEST/${BS}b-data bs=${BS} count=${COUNT}
 dd if=/dev/zero of=$DEST/${BS}b-data bs=${BS} count=${COUNT}
date
echo touch $DEST/${BS}b-write-endtime
 touch $DEST/${BS}b-write-endtime
date
echo sync
 sync
date
# any delay caused by sync will show up on next starttime
done

echo touch $DEST/testover-write-endtime
touch $DEST/testover-write-endtime
date


pi@raspberrypi ~ $ cat read-throughputtest.sh
#!/bin/sh
SRCE=$1

# 18 x 1GiB = 18GiB

# assuming maximum read 40MiB/sec this should take 8 minutes
# assuming poor read speed of 5 MiB/sec this should take 2 hours
# This script assumes that write-throughputtest.sh was run
# previously to generate the data files.

date
echo sync
sync
date

for BS in 8 16 32 64 128 256 \

        512 1024 2048 4096 8192 16384 \
        32768 65536 131072 262144 524288 1048576

do

 COUNT=`expr 1073741824 / $BS`
date
echo dd of=/dev/null if=$SRCE/${BS}b-data bs=${BS} count=${COUNT}
 dd of=/dev/null if=$SRCE/${BS}b-data bs=${BS} count=${COUNT}
date
echo sync
 sync
date
done

date


pi@raspberrypi ~ $



 Results

USB disk performance check Raspberry Pi normal USB (internal 3 port hub)


Raspberry Pi Model B USB disk write results
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------            
(bytes)ext2       ext3       ext4       vfat
8       0.2 MiB/s  0.3 MiB/s  0.3 MiB/s  0.8 MiB/s
16      0.4 MiB/s  0.5 MiB/s  0.6 MiB/s  1.5 MiB/s
32      0.9 MiB/s  1.0 MiB/s  1.1 MiB/s  2.9 MiB/s
64      2.5 MiB/s  1.8 MiB/s  1.9 MiB/s  4.4 MiB/s
128     4.7 MiB/s  3.2 MiB/s  3.5 MiB/s  6.3 MiB/s
256     7.4 MiB/s  5.5 MiB/s  6.1 MiB/s  9.4 MiB/s
512    10.6 MiB/s  8.5 MiB/s  9.5 MiB/s 12.2 MiB/s
1k     14.9 MiB/s 11.3 MiB/s 13.8 MiB/s 13.1 MiB/s
2k     18.4 MiB/s 14.2 MiB/s 18.6 MiB/s 15.1 MiB/s
4k     20.8 MiB/s 17.7 MiB/s 22.5 MiB/s 17.0 MiB/s
8k     21.3 MiB/s 18.6 MiB/s 22.8 MiB/s 16.7 MiB/s
16k    21.3 MiB/s 19.0 MiB/s 22.4 MiB/s 17.0 MiB/s
32k    21.3 MiB/s 19.0 MiB/s 22.5 MiB/s 16.9 MiB/s
64k    20.7 MiB/s 18.7 MiB/s 22.9 MiB/s 16.9 MiB/s
128k   21.3 MiB/s 18.1 MiB/s 22.7 MiB/s 16.4 MiB/s
256k   21.3 MiB/s 18.4 MiB/s 22.4 MiB/s 16.5 MiB/s
512k   21.6 MiB/s 18.9 MiB/s 22.3 MiB/s 16.8 MiB/s

1M     20.9
MiB/s 19.2 MiB/s 22.4 MiB/s 16.9 MiB/s

For the small block sizes there is almost no disk activity, long pauses with no blinking RED LED's.
I'm begining to wonder if some options in Raspbian have been enabled to extend the life of the RPi SSD.

Raspberry Pi Model B USB disk read results
-----------------------------------------------------------
block             filesystem type
size   -------------------------------------------           
(bytes)ext2       ext3       ext4       vfat
8       1.6 MiB/s  2.0 MiB/s  1.7 MiB/s  1.9 MiB/s
16      3.9 MiB/s  3.5 MiB/s  3.6 MiB/s  3.8 MiB/s
32      6.9 MiB/s  6.7 MiB/s  7.2 MiB/s  6.8 MiB/s
64     
10.5 MiB/s 10.4 MiB/s 10.2 MiB/s 10.4 MiB/s
128    18.0 MiB/s 16.5 MiB/s 15.2 MiB/s 17.0 MiB/s
256    23.3 MiB/s 22.6 MiB/s 22.1 MiB/s 22.2 MiB/s
512    23.2 MiB/s 23.2 MiB/s 23.4 MiB/s 21.7 MiB/s
1k     23.6 MiB/s 23.2 MiB/s 23.6 MiB/s 22.0 MiB/s
2k     23.7 MiB/s 23.2 MiB/s 23.6 MiB/s 22.3 MiB/s
4k     23.6 MiB/s 22.9 MiB/s 23.6 MiB/s 23.3 MiB/s
8k     22.6 MiB/s 22.3 MiB/s 23.7 MiB/s 23.7 MiB/s
16k    23.6 MiB/s 23.6 MiB/s 23.7 MiB/s 23.7 MiB/s
32k    22.4 MiB/s 23.6 MiB/s 22.6 MiB/s 23.7 MiB/s
64k    22.5 MiB/s 23.6 MiB/s 22.7 MiB/s 23.7 MiB/s
128k   23.7 MiB/s 22.4 MiB/s 22.8 MiB/s 23.7 MiB/s
256k   23.7 MiB/s 22.5 MiB/s 23.8 MiB/s 23.7 MiB/s
512k   23.7 MiB/s 22.6 MiB/s 23.7 MiB/s 23.7 MiB/s
1M     23.7 MiB/s 22.4 MiB/s 23.7 MiB/s 23.7 MiB/s




USB disk performance check (midrange desktop PC) - dedicated USB port

For comparison with the above Raspberry Pi results , here are desktop PC results:

midrange desktop PC disk write results (dedicated HS USB 2.0 port)
------------------------------------------------------------------
block             filesystem type
size   -------------------------------------------             
(bytes)ext2       ext3       ext4       vfat
8       6.3 MiB/s  3.8 MiB/s  3.9 MiB/s  5.4 MiB/s
16     12.9 MiB/s  7.6 MiB/s  7.8 MiB/s 11.1 MiB/s
32     26.1 MiB/s 15.0 MiB/s 15.9 MiB/s 19.4 MiB/s
64     34.9 MiB/s 21.1 MiB/s 31.7 MiB/s 23.3 MiB/s
128    34.9 MiB/s 21.8 MiB/s 37.7 MiB/s 24.0 MiB/s
256    34.2 MiB/s 22.2 MiB/s 37.5 MiB/s 23.4 MiB/s
512    34.1 MiB/s 22.7 MiB/s 37.3 MiB/s 23.5 MiB/s
1k     34.1 MiB/s 22.8 MiB/s 37.1 MiB/s 24.7 MiB/s
2k     33.8 MiB/s 22.7 MiB/s 37.5 MiB/s 24.5 MiB/s
4k     34.0 MiB/s 22.3 MiB/s 37.2 MiB/s 24.4 MiB/s
8k     34.1 MiB/s 22.7 MiB/s 37.4 MiB/s 24.9 MiB/s
16k    35.1 MiB/s 22.9 MiB/s 37.5 MiB/s 23.7 MiB/s
32k    36.0 MiB/s 22.7 MiB/s 37.5 MiB/s 25.4 MiB/s
64k    35.4 MiB/s 23.5 MiB/s 37.6 MiB/s 24.8 MiB/s
128k   35.3 MiB/s 23.1 MiB/s 37.2 MiB/s 24.4 MiB/s
256k   35.6 MiB/s 23.0 MiB/s 37.6 MiB/s 25.5 MiB/s
512k   35.9 MiB/s 23.3 MiB/s 37.6 MiB/s 25.2 MiB/s
1M     35.9 MiB/s 22.7 MiB/s 37.6 MiB/s 25.2 MiB/s

For High Speed USB 2.0 the maximum data rate is about 40MB/sec (38.1MiB/sec) None of the tested filesystems hit this but ext4 did come closest, but not on the Raspberry Pi unfortunately.

('lsusb -t' does shows 480M, which in theory would correspond to 57.2MiB/sec, but there protocol overheads within USB. The maximum should be 53.248 MB/s, but this appears to be deliberately limited to around 30-42MB/sec to maintain interoperability with USB stacks in OS'es over throughput speed).

midrange desktop PC disk read results (dedicated HS USB 2.0 port)
-----------------------------------------------------------------
block             filesystem type
size   -------------------------------------------            
(bytes)ext2       ext3       ext4       vfat
8      18.4 MiB/s 16.8 MiB/s 18.4 MiB/s 18.6 MiB/s
16     32.5 MiB/s 29.3 MiB/s 36.6 MiB/s 35.0 MiB/s
32     32.5 MiB/s 29.0 MiB/s 35.9 MiB/s 34.5 MiB/s
64     33.6 MiB/s 30.4 MiB/s 36.2 MiB/s 35.6 MiB/s
128    33.3 MiB/s 29.9 MiB/s 36.0 MiB/s 35.0 MiB/s
256    32.7 MiB/s 30.3 MiB/s 36.1 MiB/s 34.8 MiB/s
512    33.4 MiB/s 29.9 MiB/s 36.0 MiB/s 35.0 MiB/s
1k     33.5 MiB/s 30.2 MiB/s 36.2 MiB/s 35.9 MiB/s
2k     33.7 MiB/s 30.7 MiB/s 36.4 MiB/s 34.7 MiB/s
4k     34.0 MiB/s 30.5 MiB/s 36.1 MiB/s 35.9 MiB/s
8k     34.0 MiB/s 30.8 MiB/s 36.4 MiB/s 35.4 MiB/s
16k    34.0 MiB/s 30.9 MiB/s 36.4 MiB/s 35.5 MiB/s
32k    34.0 MiB/s 30.7 MiB/s 36.5 MiB/s 35.2 MiB/s
64k    33.7 MiB/s 30.4 MiB/s 36.4 MiB/s 35.2 MiB/s
128k   33.5 MiB/s 30.7 MiB/s 36.4 MiB/s 36.0 MiB/s
256k   33.4 MiB/s 30.5 MiB/s 36.4 MiB/s 34.8 MiB/s
512k   33.5 MiB/s 30.5 MiB/s 36.1 MiB/s 35.8 MiB/s
1M     33.2 MiB/s 30.5 MiB/s 36.5 MiB/s 35.7 MiB/s



I really wonder what the USB performance is for a Model A, which does not have an internal 3 port USB hub inside with a USB NIC connected to one of the ports. For all of the tests above there was basically no network traffic to/from the RPi, and even with that the performance of the USB  is not all that great. But even so it does appear that USB is the fastest way to get data into and out of the Raspberry Pi.


Internal disk performance check (midrange desktop PC)

I reconnected the same 2TB disk to a dedicated 1.5Gbit/sec eSATA port on the back of the desktop PC just to confirm that USB was in fact the bottleneck for data transfers. And to verify that there were no problems with the hard disk that I used.

midrange desktop PC disk write results (1.5 Gbit/sec eSATA port)
------------------------------------------------------------------
block             filesystem type
size   -------------------------------------------            
(bytes)ext2       ext3       ext4       vfat
8       7.2 MiB/s  4.2 MiB/s  4.2 MiB/s  6.4 MiB/s
16     14.6 MiB/s  8.4 MiB/s  8.6 MiB/s 12.3 MiB/s
32     28.5 MiB/s 16.2 MiB/s 16.9 MiB/s 22.0 MiB/s
64     55.9 MiB/s 29.2 MiB/s 34.3 MiB/s 35.5 MiB/s
128    72.1 MiB/s 53.7 MiB/s 61.8 MiB/s 47.8 MiB/s
256    69.4 MiB/s 64.6 MiB/s 59.4 MiB/s 52.4 MiB/s
512    68.3 MiB/s 63.2 MiB/s 58.7 MiB/s 52.7 MiB/s
1k     66.9 MiB/s 62.1 MiB/s 58.4 MiB/s 54.1 MiB/s
2k     66.2 MiB/s 61.4 MiB/s 58.7 MiB/s 54.1 MiB/s
4k     64.8 MiB/s 60.7 MiB/s 58.1 MiB/s 54.1 MiB/s
8k     64.3 MiB/s 60.2 MiB/s 57.3 MiB/s 53.5 MiB/s
16k    64.5 MiB/s 60.6 MiB/s 57.2 MiB/s 52.5 MiB/s
32k    63.2 MiB/s 59.7 MiB/s 56.9 MiB/s 55.4 MiB/s
64k    63.4 MiB/s 60.7 MiB/s 56.8 MiB/s 53.3 MiB/s
128k   62.8 MiB/s 59.2 MiB/s 56.6 MiB/s 53.0 MiB/s
256k   62.6 MiB/s 59.6 MiB/s 56.4 MiB/s 53.1 MiB/s
512k   62.1 MiB/s 58.7 MiB/s 55.3 MiB/s 52.2 MiB/s
1M     61.6 MiB/s 58.3 MiB/s 53.9 MiB/s 52.3 MiB/s



midrange desktop PC disk read results (1.5 Gbit/sec eSATA port)
-----------------------------------------------------------------
block             filesystem type
size   -------------------------------------------           
(bytes)ext2       ext3       ext4       vfat
8      18.7MiB/s  18.6MiB/s  18.5MiB/s  18.5MiB/s
16     36.4MiB/s  36.4MiB/s  36.8MiB/s  36.6MiB/s
32     71.2MiB/s  70.1MiB/s  72.5MiB/s  70.0MiB/s
64    117.3MiB/s 110.6MiB/s  98.2MiB/s  82.3MiB/s
128   116.3MiB/s 111.6MiB/s  98.2MiB/s  82.8MiB/s
256   117.3Mib/s 110.6MiB/s  98.2MiB/s  81.9MiB/s
512   117.3Mib/s 110.6MiB/s  99.2MiB/s  81.3MiB/s
1k    116.3MiB/s 109.7MiB/s  98.2MiB/s  81.3MiB/s
2k    118.3MiB/s 108.7MiB/s  97.3MiB/s  81.3MiB/s
4k    117.3Mib/s 108.7MiB/s  96.3MiB/s  81.3MiB/s
8k    117.3Mib/s 108.7MiB/s  95.2MiB/s  81.3MiB/s
16k   118.3MiB/s 108.7MiB/s  95.4MiB/s  81.3MiB/s
32k   118.3MiB/s 108.7MiB/s  95.4MiB/s  81.3MiB/s
64k   118.3MiB/s 108.7MiB/s  95.3MiB/s  81.3MiB/s
128k  118.3MiB/s 108.7MiB/s  95.3MiB/s  81.0MiB/s
256k  118.3MiB/s 108.7MiB/s  95.2MiB/s  81.4MiB/s
512k  118.3MiB/s 108.7MiB/s  94.7MiB/s  81.3MiB/s
1M    118.3MiB/s 107.8MiB/s  94.2MiB/s  81.3MiB/s


All the results say that the HDD was functioning within expected parameters. So all transfer limits (64+ bytes) were due to USB protocol limitation or the 3 port USB hub internal to the Raspberry Pi.