We have a Thecus N8800Pro fileserver to cover the institute’s storage needs. The storage system is connected to a Linux box via a 1Gbit/sec switch and is accessed by NFS. While the read performance was acceptable (about 85MByte/sec) the write performance left much to be desired (just 3MByte/sec). After some research the cause seemed to be the sync setting in /etc/exports which is responsible for synchronous data transfer:

"/raid0/data/usershare" 172.x.x.x (rw,no_root_squash,sync,anonuid=99,anongid=99)

For test purposes I changed it to async and sent the reload command to the NFSd (/app/bin/rc/rc.nfsd reload). Note: Do not attempt to restart the NFSd instead. For some reason it completely stopped working when doing so and the only way to get it back up was to disable and enable the NFS module using the web interface or restart the machine.

After remounting the shares on the Linux box we finally had a good write performance (about 75megs/sec). The only problem was to make the async setting stick. The Thecus machines seem to completely rebuild the configuration whenever a configuration change was done using the web interface and, what was worse, when the system was rebooted. Obviously this overwrote the async change every time. The script responsible for it also resides on a read-only filesystem so changes to the script weren’t possible (and would have been reverted by a firmware upgrade anyway, I’m afraid).

To solve this issue I had to get a bit creative. There is a META module for the Thecus N5200 which runs all executable files in a certain directory on startup. Unfortunately it can’t be installed on the N8800pro by default. To get it to work, download the archive and the link above, extract it on a box with the make command available (your typical Linux box will do) and change to META/Configure. You’ll need to adjust the install.rdf file (XML) and change the NasType n5200 to n8800 and set NasVersion to the version shown at the bottom right in your web interface (3.05.02.2 in my case). Afterwards go back to directory including the META.mod file and run ‘make’. It should generate a new META.mod which can now be installed on the N8800Pro.

Afterwards, SSH to the N8800Pro and change to  /raid/data/module/META/system/etc/startup. Executable files in this directory will be run at system startup.
Create a file (e.g. nfs_async.sh) with the following content:

#!/bin/bash
sed -i 's/,sync,/,async,/g' /etc/exports
/app/bin/rc/rc.nfsd reload

and make it executable (chmod +x nfs_async.sh). Now the async setting should be set to all your exports on reboot.

This still leaves the problem that whenever the share configuration is changed it will be overwritten and the machine has either to be restarted (to run META module) or the script has to be called manually. Since both ways are not really desirable, the next step will be to make sure that the exports file is adjusted during runtime when neccessary. I’ll update this post when I got a working solution. It will probably be based on META to update the crontab file on startup and a cron script that will periodically check whether the /etc/exports file was changed (or has sync entries) and fix it when neccessary.

Attention: Using the async option might have unexpected consequences. We haven’t been running the configuration long enough to be sure that there are no side-effects. Use this method at your own risk and try it with less important data for a while before using it on productive files.

 

Update 2011-08-13: Matt Robinson from ISP Dr Internet Solutions was kind enough to provide the following script for all readers. It can remotely adjust the async setting and perform a short performance test. If your “sys” user has a password, you might want to store a public key on the Thecus machines.

# Fix up the nas async nfs export to fix speed for Thecus NASs
#       — run this on any nas after it is rebooted etc
#
#  Usage: fixnas.sh nas_name [ fix | show | test ]
#
#  Put this script in a directory where the nas_host_name is
#    another dir name and mount point in side it, ie:
#
#       …./remote-mounts/fixnas.sh
#      …./remote-mounts/my-nas-01/
#      …./remote-mounts/my-nas-02/
#
#  MR: 12-08-2011   matts@ispdr.net.au  thanx to Michael Meier

# Local Progs
DD=”/bin/dd”
SSH=”/usr/bin/ssh”

# Thecus ssh user
USER=”sys”

# Test Parms
COUNT=”100000″
FILE=”SPEED-TEST”

# Commands To Run On Nas
SHO_CMD=”cat /etc/exports”
FIX_CMD=”sed -i ‘s/,sync,/,async,/g’ /etc/exports; /app/bin/rc/rc.nfsd reload”

# Check Args
[ $# -ne 2 ] && echo -e “nUsage: $0 nas_name [ fix | show | test ] n” && exit 1
NAS=”$1″

# Parse Command And Run On Host
case “$2″ in

fix)            # Run Fix
echo -e “nFixing Async Exports On $NAS”
$SSH “$USER@$NAS” “$FIX_CMD”
echo -e “Done!n”
;;

show)           # Run Show
echo -e “nNFS Exports On $NAS:”
$SSH “$USER@$NAS” “$SHO_CMD”
echo
;;

test)           # Run Test
echo -e “nTesting Write To $NAS:”
$DD “if=/dev/zero” “of=$NAS/$FILE” “bs=8k” “count=$COUNT”
rm -f “$NAS/$FILE”
echo
;;

*)              # Invalid Command
echo -e “nInvalid Commandn”
exit 1
esac

exit 0