Nfssettings

Discussion about using NAS on Linux and Unix OS.

Re: Nfssettings

Postby ronc » Mon Jul 14, 2008 9:18 am

Here's a typical entry from my TS209 (non-pro ;-)) nfssetting file:

/share/HDB_DATA/Qweb = rw,no_subtree_check

The bit in capitals will depend on how your box is configured, but that is easy to find out by ssh'ing in as admin and doing an ls -al of /share. The subdir can now be mounted by making the following entry in the /etc/fstab of another Linux box:

<TSx09 IP or name>:/Qweb /mnt/qnap/www nfs defaults 0 0

Then issue a:
$ sudo mount -a

This assumes you've created the mount point, naturally.

I have now supplied the trick of enabling NFS on a non-pro box about 20 times. I've kept the info off the general posts out of respect for the QNAP folk, but it's driving me insane, so here is my hack. If the moderators think I've stepped over the line, they are free to censor it (or me ;-)).

Ron

------------------------

The following Works For Me and assumes the perpetrator is not totally Linux ignorant and is happy using the command line shell and a text editor (knowing how to drive "vi" is an essential Unix survival skill ;-).

In other words: Don't Blame Me! My environment is:
QNAP TS-209 with 1.1.5 firmware (non-pro version, but they are the same anyway)
GNU/Linux 2.6.17-1.2187_FC5 (Fedora Core 5)

1. From the Linux box, ssh (or telnet) to your TS209 as admin

2. Edit /etc/config/nfssetting (the file should already exist, but be empty). Add the following 2 lines:
[Access]
/share = rw

3. Enable NFS with the command
# setcfg NFS Enable True

(this writes to flash ram, so the change persists with restarts)

4. Start NFS
# /etc/init.d/nfs start

5. Confirm that it did the job by examining the file /etc/exports which is (re)created each time NFS is started. It should contain something like:

/share/HDB_DATA/Public *(rw,async,no_root_squash)

[the actual drive partition (eg HDB_DATA in the above example) will depend on your BYOD conf]

7. On your Linux box, confirm that NFS is active:
# /usr/sbin/showmount -e <TS209 name or IP address>

This should respond:
Export list for <TS209 name or IP address>:
/Public

Alternately, enter:
# rpcinfo -p <TS209 name or IP address>

It should show mountd, nfsd, quotad etc and their instance ports.

8. Create the mount point and mount the Public drive

# sudo mkdir -p /mnt/qnap/public
# sudo mount -t nfs <TS209 name or IP>:Public /mnt/qnap/public

This may take a few seconds and you may see a "timeout/retrying" message.
(I've used sudo as mounts must be issued as root and I think it is too dangerous to actually login as root--accidents do happen--especially to me!)

Check all is well:

# ls -al /mnt/qnap/public

Should show the contents of the QNAP Public dir.

Seems that their exporter maps /Public by default (the "/share = rw" line in nfssetting is redundant and can even be removed). You can add other shares manually to nfssetting, a line for each under the [Access] heading, eg:

/share/HDB_DATA/Qweb = rw,no_subtree_check

You will have to determine the right partition name (HDB_DATA in the above example) as this depends on the disk(s) type and RAID config you've chosen, but it's not hard to figure out

After making any changes to nfssetting, you need to restart NFS, naturally:

# /etc/init.d/nfs restart

This will make handles held by NFS mounts "stale", so you have to umount and mount them all again (there are easier ways to do this, but that's normal unix administration left as an exercise for the student ;0)

When you have everything the way you like it, add the NFS mounts to the /etc/fstab file on the Linux box so they mount at boot time, or with a "mount -a". I've confirmed that NFS auto-starts on the QNAP box after the setcfg command has been run so all the above can be a once only exercise.


To remove NFS:
1. Shutdown NFS:
# /etc/init.d/nfs stop
2. delete all lines from the nfssetting file (or replace it with an empty file of the same name)
3. Unset the (flashram) flag:
# setconf NFS Enable False
4. Delete the /etc/exports file

Your box will now look like it has never been used for NFS ;-) You might want to delete any shell history and server logs, but I doubt QNAP would really care.


Delete message
ronc
Cadet
 
Posts: 53
Joined: Thu Jan 31, 2008 1:51 pm

Re: Nfssettings

Postby stuger » Mon Jul 14, 2008 2:52 pm

BIG THANKS ! This was what i was searching for :D
TS-109, WL500gP, UFS910, 47LB2RF, DM500S, Tvix4100sh, ufs910, Zyxel p330, HTC touch diamond, HP6510b,cisco 2600
stuger
Cadet
 
Posts: 49
Joined: Fri Dec 21, 2007 10:24 pm

Re: Nfssettings

Postby malydog » Tue Jul 28, 2009 6:45 pm

dude thanks for this, worked like a charm on my 409 (non-pro model)
whilst adjusting my tinfoil hat i felt the need to lock down the NFS shares to specific IP addresses, not just "*" which allows any IP address to connect...

i got this working as described below...

Let's say you edited your /etc/config/nfssetting file like so:

[Access]
/share = rw
/share/MD0_DATA/rick = rw

And now let's say you want to restrict access to the "rick" share to IP addresses in the range 192.168.2.1 to 192.168.2.9 then you just need to add the following to /etc/config/nfssetting:

[AllowIP]
/share/MD0_DATA/rick = 192.168.2.1/9

So you will end up with your file looking like this:

Code: Select all
[Access]
/share = rw
/share/MD0_DATA/rick = rw

[AllowIP]                                                                       
/share/MD0_DATA/rick = 192.168.2.1/9


Just restart nfs as described above and you should be in business.
malydog
Cadet
 
Posts: 3
Joined: Fri Jul 24, 2009 5:47 pm
NAS Model: TS-409/409 Pro


Return to Linux & Unix (NFS)

Who is online

Users browsing this forum: No registered users and 5 guests