10 janvier 2014

cubietruck - overview and ressources

Cubietruck




cubietruck is cubieboard v3, based on A20 SoC from Allwinner (Cortex-A7 dual cores) 

Operating System:

  • Android is the default Operating System, and is already installed in the cubietruck on-board flash memory. You don't need any external storage device, and the cubietruck can be started ASAP (plug a monitor on the VGA output, and plug the power cable in a 5V USB power supply or in the USB port of your PC). Going ahead, you can use a mouse and even a keyboard in the cubieboard USB ports, and use it like an Android appliance.
  • But it is really easy to prepare a micro-SD card (from a PC, linux prefered) with a linux distro like lubuntu or fedora. Cookbook can easily be found on the web (sUe following links). My own cubietruck is running with lubuntu...


Useful links: 


cubietruck - the SATA interface

Let's try to get SATA throughput from a disk connected to the cubietruck
  • sequential read is more than 70 MB/s
  • sequential write is around 35 MB/s

These throughputs are quite good, and we really can think that the cubietruck can be used like an entry level (home) NAS appliance (there's no second SATA port, so no way to to have 2 disks in RAID1 configuration...) 



All the details:


SATA disk is connected to the cubietruck:
the device is a 2.5" 160GB Seagate HDD

root@cubietruck:~# hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
        Model Number:       ST9160314AS                             
        Serial Number:      5VC29NDA
        Firmware Revision:  0002SDM1
        Transport:          Serial
Standards:
        Used: unknown (minor revision code 0x0029) 
        Supported: 8 7 6 5 
        Likely used: 8
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors:  312581808
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:      152627 MBytes
        device size with M = 1000*1000:      160041 MBytes (160 GB)
        cache/buffer size  = 8192 KBytes
        Nominal Media Rotation Rate: 5400
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, no device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 16
        Advanced power management level: 128
        Recommended acoustic management value: 254, current value: 0
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4 
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    Host Protected Area feature set
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    DOWNLOAD_MICROCODE
           *    Advanced Power Management feature set
                SET_MAX security extension
           *    48-bit Address feature set
           *    Device Configuration Overlay feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    64-bit World wide name
           *    IDLE_IMMEDIATE with UNLOAD
                Write-Read-Verify feature set
           *    WRITE_UNCORRECTABLE_EXT command
           *    {READ,WRITE}_DMA_EXT_GPL commands
           *    Segmented DOWNLOAD_MICROCODE
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Phy event counters
                Device-initiated interface power management
           *    Software settings preservation
           *    SMART Command Transport (SCT) feature set
           *    SCT Long Sector Access (AC1)
           *    SCT Error Recovery Control (AC3)
           *    SCT Features Control (AC4)
           *    SCT Data Tables (AC5)
                unknown 206[12] (vendor specific)
Security: 
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
                supported: enhanced erase
        48min for SECURITY ERASE UNIT. 48min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 5000c50017db74f2
        NAA             : 5
        IEEE OUI        : 000c50
        Unique ID       : 017db74f2
Checksum: correct



the disk is formatted with ext4 (without any partition) and is mounted in /data



root@cubietruck:~# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root       15248268 2211744  12261948  16% /
devtmpfs          934496       4    934492   1% /dev
tmpfs              20480       4     20476   1% /tmp
none              186924     268    186656   1% /run
none                5120       0      5120   0% /run/lock
none              934604       0    934604   0% /run/shm
none              102400      16    102384   1% /run/user
/dev/sda       153837436  653672 145369220   1% /data


A simple write test: create a 8GB file on the filesystem

root@cubietruck:~# dd if=/dev/zero of=/data/tmp/testfile bs=1M count=8192
8192+0 records in
8192+0 records out
8589934592 bytes (8.6 GB) copied, 250.019 s, 34.4 MB/s



The reported IO throughput (sequential write) is 34.4 MB/s, which is quite good for this kind of device. 
The IO activity is monitored while the file is created. Throughput is not regular

Total DISK READ:       0.00 B/s | Total DISK WRITE:      12.20 M/s
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND                                                                                     
 1795 be/4 root        0.00 B/s    0.00 B/s  0.00 % 52.94 % [flush-8:0]
 1968 be/4 root        0.00 B/s   36.87 M/s  0.00 % 47.77 % dd if=/dev/zero of=/data/tmp/testfile bs=1M count=8192
  227 be/3 root        0.00 B/s   17.79 M/s  0.00 % 32.17 % [jbd2/sda-8]
    1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init
    2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % 
...



A simple read test: the 8GB file is read

root@cubietruck:~# dd if=/data/tmp/testfile of=/dev/null bs=1M
8192+0 records in
8192+0 records out
8589934592 bytes (8.6 GB) copied, 116.468 s, 73.8 MB/s


reported read throughput is 73.8 MB/s !!!

More details from sysfs (scheduler, ...)


root@cubietruck:~# cat /sys/block/sda/queue/max_sectors_kb 
512
root@cubietruck:~# cat /sys/block/sda/queue/max_hw_sectors_kb 
32767
root@cubietruck:~# cat /sys/block/sda/queue/nr_requests       
128
root@cubietruck:~# cat /sys/block/sda/queue/read_ahead_kb 
128
root@cubietruck:~# cat /sys/block/sda/queue/rotational    
1
root@cubietruck:~# cat /sys/block/sda/queue/rq_affinity 
1
root@cubietruck:~# cat /sys/block/sda/queue/max_segment_size 
65536
root@cubietruck:~# cat /sys/block/sda/queue/scheduler        
noop deadline [cfq]