Another NAS with a BananaPI

Since a few years now, I used to use a Sheevaplug as a NAS (see and The Sheevaplug was running fine, but I needed some more processing power and memory to make my document search as well as SMB file copy faster and host a saltstack master.

This install has been made with custom saltstack states from another machine before transforming itselft in my saltstack master.

Base install


Installing Archlinux on a Bananapi was not officialy supported (at time where I did the install, 1 year ago), but as the hardware is very similar to cubieboard 2, it just needed a dedicated uBoot. Hopefully, someone did it :

I also optimized the SDCard by formating it with (see here for more info):

Then I changed root password (su, passwd) and changed the hostname (/etc/hostname)

Finaly I copied my custom Salt-stack minion installer script (see here) right after a full system upgrade:

On the salt master side, thanks to the desired state configuration’s magic, a simple command deployed my full NAS solution :

I’m not going to share every states I used, just because some are pretty obvious and some others are more related to personal taste.

Basicaly what has been done is :

  • Remove alarmuser
  • Install netatalk with timemachine support
  • Manage Hard disk power
  • Install cronie / set timezone / change anacron tab for job execution during night
  • Install samba + custom configuration and optimizations
  • Install + configure SSMTP (email sending)
  • Optimizations for a20 soc
  • Install and configure smartmontools
  • Install and configure NFS
  • Set custom mount option / custom io scheduler
  • Set cpufreq to ondemand
  • Install some sysadmin tools : bash settings, lsof, unzip…
  • Install + configure regain
  • install + configure vsftp
  • Create users
  • Set network optimization

Performance tuning

Based on the following forum’s thread which was very instructive, I kept the optimizations explained below.

Initial Calibration

Without any modification on the base Archlinux install, I had:

  • hdparm -t -T /dev/sda : around 139 Mb/s
  • FTP transfert (vsftpd) : 18 Mb/s read
  • Samba : 11.3 Mb/s read and 12.0 Mb/s write

All tests have been done with a CAT5 cable on the same switch.

Tuning operations

Force ethernet IRQ to CPU 1:

Tune CPU frequency scaling:

Adjust TCP stack buffers and properties:

Finaly, set a bigger queue on eth0:


  • FTP transfert (vsftpd) : 77 Mb/s read
  • Samba : 24.1 Mb/s read and 20.3 Mb/s write

While transferring a file, the smbd process is taking 100% of one CPU core. As one file transfer seems to use only one thread, the cpu need to be overclocked to get better performances, but A20 does not easily support large overclocking.

NFS being more performant, I tested it (nfsv4, ports 2049 and 111 must be open on the firewall, both for TCP and UDP)

Result :

  • 57.3 Mb/s read (I did not benchmarked write speed).

Some of used Saltstack states

I said earlier, I’m not sharing all my states, but the following ones are more related to previously mentioned tuning.

SD card optimization

sls file:


60-schedulers.rules file:

Gigabit optimization

sls file:


file 10-iptuning.conf :


60-custom-txqueuelen.rules file:

A20 Cpu optimizations

sls file:


file 65-schedulers-sata.rules:


file a20_optim.service:

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.