Author Topic: NAS and NFS settings  (Read 1515 times)

Tim Hall

  • Victoria is my queen
NAS and NFS settings
« on: 29 January, 2018, 10:43:51 pm »
I have a Raspberry Pi running OSMC on which I run Kodi and an NFS server. It has an external drive which I export to a Ubuntu box. This mounts the NFS exports. 

Copying files to the external drive (/mnt/nas/$name) sort of works but is very erratic and slow.  Typical behavior is for the file transfer window to report a stunningly, unbelievably fast transfer rate, which after a while starts to drop off, right down to a handful of kb/s with correspondingly long estimated time to completion. After a few minutes another burst of activity and so on.  This might be just inaccurate speed reporting of course, or as the transfer is via the devils wireless wifi, I might just have to put up with it, but are there any tweaks to the /etc/exports file I can make?

Current file says
Code: [Select]
/media/Expansion_Drive 192.168.1.8(rw,sync,no_subtree_check,insecure)
The Pi is plugged into a wireless ethernet convertor, which talks to the router. The Ubuntu box talks wirelessly to the router.
There are two ways you can get exercise out of a bicycle: you can
"overhaul" it, or you can ride it.  (Jerome K Jerome)

vorsprung

  • Opposites Attract
    • Audaxing
Re: NAS and NFS settings
« Reply #1 on: 01 February, 2018, 09:51:55 pm »
There are zillions of options to try.   But first, are you TCP or UDP?  TCP is usually slightly more reliable

pdm

  • Sheffield hills? Nah... Just potholes.
Re: NAS and NFS settings
« Reply #2 on: 01 February, 2018, 10:43:44 pm »
I tend to optimise access parameters in my /etc/fstab files.

"async,udp" is usually a little faster than "sync,tcp"
"sync" is slightly safer for writing to the storage than "async" since corruption can occur if the NAS crashes during a write - a very rare occurrence.
I usually also add "noatime,nodiratime"
rsize and wsize can also be tweeked to suit your wireless MTU size (usually 2312 bytes including header bytes so 2048 should fit OK) - I don't bother usually.

Afasoas

Re: NAS and NFS settings
« Reply #3 on: 02 February, 2018, 01:00:38 pm »
Transfer rates are never going to be miraculous given the Pi's architecture.
Is the external drive independently powered?

For anyone wanting a cheap NAS I'd suggest something built on an Atom D525 motherboard - which can be picked up for similar money second hand off that popular auction site. You will need RAM, case and power supply. For the latter, look at Pico PSU or a clone.


Tim Hall

  • Victoria is my queen
Re: NAS and NFS settings
« Reply #4 on: 04 February, 2018, 08:00:25 pm »
Thanks for the answers thus far.

I think it's NFS over TCP (but how do I check?)
The external drive has its own power supply.

I just tried an experiment: Copying a 1GB file from Ubuntu box to Pi. Fluctuating speed reported and time taken 20 minutes.

Copying a 1GB file from the Pito the Ubuntu box. Steady(ish) speed in the range 1.8MB/s to 2.0MB/s, time taken 10 minutes. 

Different files used for each test, but both are .mp4

There are two ways you can get exercise out of a bicycle: you can
"overhaul" it, or you can ride it.  (Jerome K Jerome)

pdm

  • Sheffield hills? Nah... Just potholes.
Re: NAS and NFS settings
« Reply #5 on: 04 February, 2018, 10:06:47 pm »
The Pi Ethernet is a 100Mbps interface and in real life seems to max out at around 82Mbps (~8 MBytes per sec)
If you are only getting 2MBytes per sec, I suspect your bottleneck is your WiFi. Basic 2.4 GHz WiFi at 54Mbps will have a maximum of about 5 MBytes per sec. Multiple users slow thing down from there.
I have been doing some tests on my Pi3 running OSMC. It gives a maximum of about 5.2 MBytes per sec on NFS over WiFi. (2.4GHz WiFi connected at 72Mbps which seems to be about the maximum for the built in Pi3 WiFi)

If you a 5GHz ac WiFi network of reasonable quality, you may get a lot more - I get up to about 28 MBytes per sec maximum on mine with UDP transfers from other NFS servers.
I suspect about 5.2 MBytes per sec is about as good as you will get with a basic Pi3. With a USB 5GHz WiFi adaptor and good network, you may possibly get up to about 30 MBytes per sec.

Tim Hall

  • Victoria is my queen
Re: NAS and NFS settings
« Reply #6 on: 05 February, 2018, 10:21:02 pm »
OK, I get the bit about wifi (2GHz) transfer rates. But why the disparity depending on the direction of the transfer?
There are two ways you can get exercise out of a bicycle: you can
"overhaul" it, or you can ride it.  (Jerome K Jerome)

pdm

  • Sheffield hills? Nah... Just potholes.
Re: NAS and NFS settings
« Reply #7 on: 06 February, 2018, 10:00:46 pm »
Speculating:

1. Each end of the WiFi has a radio transmitter and receiver. If the one side's transmit power is lower than the other or one receiver is less sensitive then the other, long packets may be more frequently dropped at one end. The side sending a big file will send long packets, the other will send short acknowledgement ones...

2. If you have more than one device connected to a WiFi hub, packet collisions can occur if devices do not "hear" each other and their transmissions to the hub overlap. Collisions may be occurring to the detriment of the "weaker" connection and long packets will be worse affected.

Both scenarios cause asymmetry and will give higher throughput in one direction over the other.

Kim

  • Timelord
    • Fediverse
Re: NAS and NFS settings
« Reply #8 on: 07 February, 2018, 01:02:59 am »
Yup.  See https://en.wikipedia.org/wiki/Hidden_node_problem for some of the relevant theory.

Wireless networks are fickle beasts, and do this sort of thing to torment us.  Higher level protocols can complicate matters by responding to packet loss in unhelpful ways.

Tim Hall

  • Victoria is my queen
Re: NAS and NFS settings
« Reply #9 on: 08 February, 2018, 10:04:19 pm »
I've found a utility, bmon, to have a look a packet loss, collisions and data transfer rates. Screenshots are attached.


This is transferring a file from Ubuntu box to the Pi. 


this is from the Pi to the Ubuntu box.

As far as I can tell, no collisions or other errors.  Is that right?
There are two ways you can get exercise out of a bicycle: you can
"overhaul" it, or you can ride it.  (Jerome K Jerome)