nfs server on raspberry

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

nfs server on raspberry

Postby KingDuckZ » Wed Sep 26, 2012 12:39 pm

Hello, I just dd'ed the latest archlinux image available and I'd like to set up an nfs server on my raspberry pi. I installed the nfs-tools package and enabled the nfsd.service and rpcbind.service. My /etc/exports look like this:
$this->bbcode_second_pass_code('', '[root@alarmpi ~]# cat /etc/exports
# /etc/exports
#
# List of directories exported to NFS clients. See exports(5).
# Use exportfs -arv to reread.
#
# Example for NFSv2 and NFSv3:
# /srv/home hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
# /srv/nfs4 hostname1(rw,sync,fsid=0)
# /srv/nfs4/home hostname1(rw,sync,nohide)
# Using Kerberos and integrity checking:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)
# /srv/nfs4/home gss/krb5i(rw,sync,nohide)
#

/media/Anime 192.168.0.0/24(rw,sync,no_root_squash)')
and rpcinfo -p prints the following:
$this->bbcode_second_pass_code('', ' program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100227 2 tcp 2049 nfs_acl
100227 3 tcp 2049 nfs_acl
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100227 2 udp 2049 nfs_acl
100227 3 udp 2049 nfs_acl
100021 1 udp 54696 nlockmgr
100021 3 udp 54696 nlockmgr
100021 4 udp 54696 nlockmgr
100021 1 tcp 39517 nlockmgr
100021 3 tcp 39517 nlockmgr
100021 4 tcp 39517 nlockmgr
')

However, when I try to mount the exported directory on my Sabayon laptop I get:
$this->bbcode_second_pass_code('', '[root@localhost ~]# mount -t nfs 192.168.0.14:/media/Anime /media/iso/
mount.nfs: requested NFS version or transport protocol is not supported')
I tried a lot of different combinations (-o nolock,nfsvers=3,proto=tcp etc.), also from an ubuntu machine, but I couldn't get it to work. Can somebody help me with this please?

Other info that might be needed:
$this->bbcode_second_pass_code('', '[root@alarmpi ~]# uname -a
Linux alarmpi 3.2.27-6-ARCH+ #1 PREEMPT Thu Sep 20 15:32:18 UTC 2012 armv6l GNU/Linux

[root@alarmpi ~]# systemctl status nfsd.service [0m# systemctl
nfsd.service - NFS server
Loaded: loaded (/usr/lib/systemd/system/nfsd.service; enabled)
Active: active (exited) since Wed, 26 Sep 2012 13:24:46 +0100; 11min ago
Process: 200 ExecStartPost=/usr/sbin/exportfs -a (code=exited, status=0/SUCCESS)
Process: 183 ExecStart=/usr/sbin/rpc.nfsd $NFSD_OPTS $NFSD_COUNT (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/nfsd.service

Sep 26 13:24:46 alarmpi exportfs[200]: exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified ...Anime".
Sep 26 13:24:46 alarmpi exportfs[200]: Assuming default behaviour ('no_subtree_check').
Sep 26 13:24:46 alarmpi exportfs[200]: NOTE: this default has changed since nfs-utils version 1.0.x

[root@alarmpi ~]# exportfs -arv
exportfs: /etc/exports [2]: Neither 'subtree_check' or 'no_subtree_check' specified for export "192.168.0.0/24:/media/Anime".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x

exporting 192.168.0.0/24:/media/Anime
')

$this->bbcode_second_pass_code('', '[root@localhost ~]# nmap -sS 192.168.0.14

Starting Nmap 6.01 ( http://nmap.org ) at 2012-09-26 14:35 CEST
Nmap scan report for 192.168.0.14
Host is up (0.0035s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
2049/tcp open nfs
MAC Address: 48:02:2A:70:44:9E (B-Link Electronic Limited)

Nmap done: 1 IP address (1 host up) scanned in 9.77 seconds')
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: nfs server on raspberry

Postby pezz » Wed Sep 26, 2012 1:39 pm

https://wiki.archlinux.org/index.php/NFS
https://wiki.archlinux.org/index.php/NFSv3

Pretty much has all your answers, e.g for v4 you're missing:

$this->bbcode_second_pass_code('', 'systemctl start nfsd.service rpc-idmapd.service rpc-mountd.service rpcbind.service')
I just quickly got my pi serving / to another box by doing (192.168.0.1 is the client box, 192.168.0.2 is my pi):

$this->bbcode_second_pass_code('', '
pacman -S nfs-utils
mkdir -p /export/root
mount -o bind / /export/root
')
Then...

$this->bbcode_second_pass_code('', '
sudo vim /etc/exports (and add)
/export 192.168.0.1(rw,fsid=0,no_subtree_check,async,no_root_squash)
/export/root 192.168.0.1(rw,no_subtree_check,async,no_root_squash)
')
Then...

$this->bbcode_second_pass_code('', '
systemctl enable nfsd.service rpc-idmapd.service rpc-mountd.service rpcbind.service
systemctl start nfsd.service rpc-idmapd.service rpc-mountd.service rpcbind.service
')
Then on 192.168.0.1

$this->bbcode_second_pass_code('', 'mount 192.168.0.2:/export /mnt (root will be under there)')
pezz
 
Posts: 75
Joined: Fri Sep 14, 2012 11:19 pm
Location: Geelong, Australia

Re: nfs server on raspberry

Postby KingDuckZ » Wed Sep 26, 2012 2:48 pm

Thanks, I was indeed missing a couple of services! :) Now it works, but it doesn't support nfs4.
$this->bbcode_second_pass_code('', '[root@alarmpi ~]# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100227 2 tcp 2049 nfs_acl
100227 3 tcp 2049 nfs_acl
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100227 2 udp 2049 nfs_acl
100227 3 udp 2049 nfs_acl
100021 1 udp 58716 nlockmgr
100021 3 udp 58716 nlockmgr
100021 4 udp 58716 nlockmgr
100021 1 tcp 36597 nlockmgr
100021 3 tcp 36597 nlockmgr
100021 4 tcp 36597 nlockmgr
100005 1 udp 20048 mountd
100005 1 tcp 20048 mountd
100005 2 udp 20048 mountd
100005 2 tcp 20048 mountd
100005 3 udp 20048 mountd
100005 3 tcp 20048 mountd
')
If I let mount negotiate the version with -t nfs and no special -o parameter it works, but -t nfs4 fails:
$this->bbcode_second_pass_code('', '[root@localhost ~]# mount -t nfs4 -o rw,nolock 192.168.0.14:/media/Anime /media/iso/
mount.nfs4: Protocol not supported
')
The reason I care is that nfs4 has an exname option that allows for easier aliasing than rebinding as you did.
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: nfs server on raspberry

Postby pezz » Wed Sep 26, 2012 3:02 pm

Hmm, dunno mate, the way I do it, with no -o or -t, I get no error, but if I try to mount v3 with -t or -o options, or don't have it setup right, I see stuff like this in dmesg on the pi:

[96523.538426] svc: 192.168.0.1, port=786: unknown version (4 for prog 100003, nfsd)
pezz
 
Posts: 75
Joined: Fri Sep 14, 2012 11:19 pm
Location: Geelong, Australia

Re: nfs server on raspberry

Postby KingDuckZ » Wed Sep 26, 2012 3:14 pm

Hmm so maybe archlinux arm doesn't come with v4 support? I get the same message as you in my dmesg. Unfortunately most resources about this seem to be about raspbian (which requires a custom built kernel btw).
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: nfs server on raspberry

Postby pezz » Wed Sep 26, 2012 3:27 pm

Ah, yep, you might be right (maybe one of the devs can confirm):

$this->bbcode_second_pass_code('', '
[pezz@pi]-[01:24:44]-[~/Temp/linux-raspberrypi]
% grep -i nfs config
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_NFS_V4=y
CONFIG_NFS_V4_1=y
CONFIG_PNFS_FILE_LAYOUT=y
CONFIG_PNFS_BLOCK=m
CONFIG_ROOT_NFS=y
CONFIG_NFS_FSCACHE=y
CONFIG_NFS_USE_LEGACY_DNS=y
# CONFIG_NFS_USE_NEW_IDMAPPER is not set
CONFIG_NFSD=m
CONFIG_NFSD_V2_ACL=y
CONFIG_NFSD_V3=y
CONFIG_NFSD_V3_ACL=y
# CONFIG_NFSD_V4 is not set
CONFIG_NFS_ACL_SUPPORT=y
CONFIG_NFS_COMMON=y
')

Assuming "CONFIG_NFSD_V4" is the one you need.
pezz
 
Posts: 75
Joined: Fri Sep 14, 2012 11:19 pm
Location: Geelong, Australia

Re: nfs server on raspberry

Postby pepedog » Wed Sep 26, 2012 4:07 pm

I will add it in
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: nfs server on raspberry

Postby KingDuckZ » Wed Sep 26, 2012 5:05 pm

That's great, thank you!
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: nfs server on raspberry

Postby pepedog » Wed Sep 26, 2012 7:30 pm

I remember seeing this in the past, decided not to include as it's marked experimental, but I will include next round
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: nfs server on raspberry

Postby pepedog » Wed Sep 26, 2012 9:00 pm

OK, wait for -8 kernel in upgrades
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 7 guests