NFSv4 on QTS 4.2.X - setup and usage

Discussion about using NAS on Linux and Unix OS.
Post Reply
mamfelt
Starting out
Posts: 14
Joined: Mon Jan 13, 2014 9:04 pm

NFSv4 on QTS 4.2.X - setup and usage

Post by mamfelt »

Was happy to read NFSv4 support is available (not just hooks) as helpdesk said otherwise (only that it was coming in 4.3.X).

For others like myself, who will not be able to go to 4.3.X (wrong Intel processor ;( ) - Having some instructions on how to work with NFSv4 in a single post might be useful!

On many systems, NFSv4 is now default - with one important "hidden" default I'll be asking about below.

So, once you activate NFSv4 - if you need NFSv3 you (may) need to add "vers=3" to your mount options.

Step 1: activate NFSv4 on your QNAP NAS

As it is not part of the GUI - login as admin via ssh and then:

Code: Select all

[~] # /sbin/setcfg NFS Enable_V4 TRUE
[~] # /etc/init.d/nfs restart
nfs_get_lock
Shutting down NFS services: OK
Starting NFS services: re-export.
Shutting down NFS mountd:
Starting NFS mountd. Mountd port number = 30000.
OK
[~] #
Step 2: From a client

I have not seen rpcinfo on QNAP - so I call use it from a client to query the server.

Code: Select all

michael@x071.home.local:[/home/michael]rpcinfo -p x053 | grep nfs
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
The UDP entry for NFSv4 surprises me. Not illegal, just uncommon (by default NFSv3 and NFSv4 connect using TCP, while NFSv2 uses UDP by default).

Step 3: The basics are running - but there is one more setting that must match for NFSv4 to work - the so-called domain.

Some versions of Linux have this setup to be the DNS domain, e.g., qnap.home.local would be "qnap" as short hostname, and "home.local" as the (default) NFSv4 domain. On (most) Linux distributions - so I assume also for QNAP - this is configured via the file /etc/idmapd.conf

Code: Select all

[~] # cat /etc/idmapd.conf
[General]

Verbosity = 9
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = localdomain

[Mapping]

Nobody-User = guest
Nobody-Group = guest
In otherwords, the keyword "localdomain" becomes "home.local" (from qnap.home.local as FQDN).

FYI: On AIX this is set using the command: chnfsdom <domain>, and is viewed by chnfsdom; #no argument. The domain name is stored in the file /etc/nfs/domain (not newline terminated) - e.g.,

Code: Select all

root@x071.home.local:[/home/root]od -dc /etc/nfs/local_domain
0000000   29295   28532   30311
          r   o   o   t   v   g
0000006
So, the command I would like to see on QNAP is "nfsmapid" so I could view the NAS's idea of "localdomain". atm, I think it is "blank".

Code: Select all

[~] # hostname
qnap
[~] # nslookup qnap
Server:     fritz.box
Address:    192.168.120.254

Name:       qnap
Address:    192.168.120.53
In closing, (for the moment) - activating is simple, but verifying status - on the QNAP as server - is difficult. I expect I am going to have to make some modifications in the hostname for NFSv4 to be useable - or perhaps, easier, read the man page on idmapd.conf and manually assign an NFSv4 domain.

Update: I edited the file /etc/imapd.conf and changed the domain to home.local (and on AIX, ran chnfsdom home.local). I also had to restart NFS on AIX to get te NFS domain part active.

I was able to mount the NFSv4 root - but it was empty - as QNAP defines /share/NFS=4/ as the NFSv4 root - and there is nothing there.

Note: on the QNAP /share is the alias path for NFSv3 exports. e.g., mount -h qnap -d /Web -f /mnt mounts /share/Web on /mnt on the client. On QNAP /share/Web is a symbolic link to /MD0_DATA/Web. I tried adding a symbolic link (as you would find in /share)

Code: Select all

[/share] # ls -ld *Web */*Web
drwxrwxrwx    8 admin    administ      4096 May 10 08:31 MD0_DATA/Web/
drwxrwxrwx    9 admin    administ      4096 Feb 20 13:09 MD1_DATA/Web/
lrwxrwxrwx    1 admin    administ        19 May 11 12:17 NFSv=4/Web -> /share/MD0_DATA/Web/
lrwxrwxrwx    1 admin    administ        12 May 10 08:28 Web -> MD0_DATA/Web/
While the last line works for an NFSv3 mount, the second to the last line does not. On client see:

Code: Select all

michael@x071.home.local:[/nfs]ls -l
total 0
lrwxrwxrwx 1 root system 19 May 11 12:17 Web -> /share/MD0_DATA/Web
I have the idea something should be there, because the mount command on the QNAP shows additional mounts:

Code: Select all

[/share] # mount | grep NFSv
tmpfs on /share/NFSv=4 type tmpfs (rw,size=16M)
/share/MD0_DATA/aixtools on /share/NFSv=4/aixtools type none (rw,bind)
/share/MD0_DATA/distros on /share/NFSv=4/distros type none (rw,bind)
/share/MD0_DATA/httpd on /share/NFSv=4/httpd type none (rw,bind)
/share/MD0_DATA/michael on /share/NFSv=4/michael type none (rw,bind)
/share/MD0_DATA/projects on /share/NFSv=4/projects type none (rw,bind)
tmpfs on /share/NFSv=4 type tmpfs (rw,size=16M)
/share/MD0_DATA/Web on /share/NFSv=4/Web type none (rw,bind)
tmpfs on /share/NFSv=4 type tmpfs (rw,size=16M)
As the /share/NFSv=4 shows multiple times, AND after the "share" mounts on top of /share/NFSv=4 precedes these - I am guessing I need a reboot. The normal stop/start of NFS is not parsing everything as I would expect it to do.
mamfelt
Starting out
Posts: 14
Joined: Mon Jan 13, 2014 9:04 pm

Re: NFSv4 on QTS 4.2.X - setup and usage

Post by mamfelt »

Well, reboot did not resolve anything: Still have this as /etc/mtab

Code: Select all

[/etc] # cat mtab
/proc /proc proc rw 0 0
none /dev/pts devpts rw,gid=5,mode=620 0 0
sysfs /sys sysfs rw 0 0
tmpfs /tmp tmpfs rw,size=64M 0 0
tmpfs /dev/shm tmpfs rw 0 0
tmpfs /share tmpfs rw,size=16M 0 0
none /proc/bus/usb usbfs rw 0 0
/dev/sda4 /mnt/ext ext3 rw 0 0
/dev/md9 /mnt/HDA_ROOT ext3 rw,data=ordered 0 0
/dev/md0 /share/MD0_DATA ext4 rw,usrjquota=aquota.user,jqfmt=vfsv0,user_xattr,data=ordered,nodelalloc,acl 0 0
/dev/md1 /share/MD1_DATA ext4 rw,usrjquota=aquota.user,jqfmt=vfsv0,user_xattr,data=ordered,nodelalloc,acl 0 0
tmpfs /mnt/rf/nd tmpfs rw,size=1m 0 0
none /sys/kernel/config configfs rw 0 0
tmpfs /var/syslog_maildir tmpfs rw,size=8M 0 0
/dev/sdi1 /share/external/sdi1 ufsd rw,iocharset=utf8,dmask=0000,fmask=0111,force 0 0
nfsd /proc/fs/nfsd nfsd rw 0 0
rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
tmpfs /share/NFSv=4 tmpfs rw,size=16M 0 0
/share/MD0_DATA/aixtools /share/NFSv=4/aixtools none rw,bind 0 0
/share/MD0_DATA/distros /share/NFSv=4/distros none rw,bind 0 0
/share/MD0_DATA/httpd /share/NFSv=4/httpd none rw,bind 0 0
/share/MD0_DATA/michael /share/NFSv=4/michael none rw,bind 0 0
tmpfs /share/NFSv=4 tmpfs rw,size=16M 0 0
tmpfs /share/NFSv=4 tmpfs rw,size=16M 0 0
And, with all the over-mounting on /share/NFSv=4 involved - not surprising that

Code: Select all

/share/NFSv4
shows as empty.

Not being "Linux" minded, I am having some trouble finding where all these mounts are coming from - as /etc/fstab is quite small.

Code: Select all

[/etc] # cat fstab
# /etc/fstab: static file system information.
#
# <file system> <mount pt>     <type>   <options>         <dump> <pass>
/dev/ram       /              ext2      defaults         1      1
proc            /proc          proc     defaults          0      0
none            /dev/pts        devpts  gid=5,mode=620  0       0
Apparently there are lots of locations (one is not enough I guess) where mounts are defined. Grepping through 100's of files to find mount commands is quite boring (IMHO).

Suggestions welcome! (For now I am going to try and disable, read "turn off" NFSv4 using:

Code: Select all

[/etc] # /sbin/setcfg NFS Enable_V4 FALSE
[/etc] # /etc/init.d/nfs status
nfs_get_lock
Usage: /etc/init.d/nfs {start|stop|restart|reexport|remountd|create_keytab}
[/etc] # /etc/init.d/nfs start
nfs_get_lock
Starting NFS services: re-export.
Shutting down NFS mountd:
Starting NFS mountd. Mountd port number = 30000.
OK
This did not remove any of the current /share/NFSv=4 entries (mounts)

Code: Select all

[/etc] # mount
/proc on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
sysfs on /sys type sysfs (rw)
tmpfs on /tmp type tmpfs (rw,size=64M)
tmpfs on /dev/shm type tmpfs (rw)
tmpfs on /share type tmpfs (rw,size=16M)
none on /proc/bus/usb type usbfs (rw)
/dev/sda4 on /mnt/ext type ext3 (rw)
/dev/md9 on /mnt/HDA_ROOT type ext3 (rw,data=ordered)
/dev/md0 on /share/MD0_DATA type ext4 (rw,usrjquota=aquota.user,jqfmt=vfsv0,user_xattr,data=ordered,nodelalloc,acl)
/dev/md1 on /share/MD1_DATA type ext4 (rw,usrjquota=aquota.user,jqfmt=vfsv0,user_xattr,data=ordered,nodelalloc,acl)
tmpfs on /mnt/rf/nd type tmpfs (rw,size=1m)
none on /sys/kernel/config type configfs (rw)
tmpfs on /var/syslog_maildir type tmpfs (rw,size=8M)
/dev/sdi1 on /share/external/sdi1 type ufsd (rw,iocharset=utf8,dmask=0000,fmask=0111,force)
nfsd on /proc/fs/nfsd type nfsd (rw)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
tmpfs on /share/NFSv=4 type tmpfs (rw,size=16M)
/share/MD0_DATA/aixtools on /share/NFSv=4/aixtools type none (rw,bind)
/share/MD0_DATA/distros on /share/NFSv=4/distros type none (rw,bind)
/share/MD0_DATA/httpd on /share/NFSv=4/httpd type none (rw,bind)
/share/MD0_DATA/michael on /share/NFSv=4/michael type none (rw,bind)
tmpfs on /share/NFSv=4 type tmpfs (rw,size=16M)
tmpfs on /share/NFSv=4 type tmpfs (rw,size=16M)
But it did remove them from the exports

Code: Select all

[/etc] # cat exports
"/share/MD0_DATA/Web" *(ro,async,no_subtree_check,insecure,root_squash)
"/share/MD0_DATA/aixtools" 192.168.129.64/28(rw,async,no_subtree_check,insecure,no_root_squash)
"/share/MD0_DATA/distros" 192.168.129.63(rw,async,no_subtree_check,insecure,no_root_squash)
"/share/MD0_DATA/httpd" 192.168.129.64/28(rw,async,no_subtree_check,insecure,no_root_squash)
"/share/MD0_DATA/michael" 192.168.129.0/24(ro,async,no_subtree_check,insecure,root_squash)
"/share/MD0_DATA/projects" 192.168.129.64/28(rw,async,no_subtree_check,insecure,no_root_squash) 192.168.129.60/30(rw,async,no_subtree_check,insecure,no_root_squash) 192.168.129.72/31(rw,async,no_subtree_check,insecure,no_root_squash)
Again, suggestions welcome. I am going to try a reboot (again) to see what that cleans up - but having to reboot is so "unprofessional". Sigh.
mamfelt
Starting out
Posts: 14
Joined: Mon Jan 13, 2014 9:04 pm

Re: NFSv4 on QTS 4.2.X - setup and usage

Post by mamfelt »

FYI: the reboot cleared away the /share/NFSv=4 related mounts.
Post Reply

Return to “Linux & Unix (NFS)”