5

Using a simple setup with PI as a NAS, with an attached USB disk, like this:

[RPI] (USB) -> Ethernet -> USB 2.0 Disk

Of course both network and disk access share the same USB port, but is there any way to optimize this in terms of speed? Any input is welcome!

Right now, I have something like 1400KB/S when transfering files via SFTP. Have someone made it run faster, and if so, how?

5
  • Which OS you using? Oct 21, 2012 at 19:48
  • Debian (raspbian/wheezy). Pretty much default latest from raspberrypi.org Oct 21, 2012 at 21:25
  • 1
    Just checking you were using hard float... Update your firmware. Oct 21, 2012 at 21:26
  • Firmware is almost certainly your first step. The newest release increased USB transfer rates dramatically.
    – Jivings
    Oct 21, 2012 at 23:38
  • Thanks!Updating software/firmware did nothing for open ssh (sftp) transfers, but for SMB it did double the speed (~3MB/s). Oct 22, 2012 at 17:48

2 Answers 2

4

SFTP (SSH + FTP) is CPU intensive and the Pis CPU probably limits the bandwidth. If encrypting the data traffic is optional, consider using an unencrypted file transfer protocol like FTP. Also note that a router with NAT can prevent access to your NAS from the outside internet, so perhaps even authentication is optional. If you can trust your network's users, use a protocol that does not support authentication like TFTP. (TFTP does also not support directory listings which might be essential.) Please note that the "use of TFTP is strongly discouraged except in the most limited of circumstances where memory and CPU are at the highest premium.".

1
2

The file system of the disk matters, for example writing to NTFS is known to be slow. Ext3 or 4 are faster, if changing the file system is an option. Anyway, mounting with the noatime option should improve the performance. noatime is helps with the SD-card performance too.

SFTP is cpu-heavy due to the encrypted transfer. NFS or samba are lighter. You could run 'top' on the pi while reading from or writing to the disk, to find out if the CPU usage is an issue, and which program/subsystem is the bottleneck.

I did a quick test, with SFTP from a usb hard drive with NTFS on it. Writing: 1.9 MB/s ssh and sftp took 45% of the cpu time, mount.ntfs took 40%. Reading: 3.0 MB/s, ssh and sftp took 80% ot the cpu time.

A thread about ntfs performance: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=20252&p=198958

1
  • In this case - IO to NTFS in Linux.. not so great. True better use Ext. Emulation NTFS is a pain in the CPU
    – Piotr Kula
    Oct 23, 2012 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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