Unable to mount NFS share [Solved]

Issues Related to Networking (Wired and Wireless)

Moderator: Moderators

Unable to mount NFS share [Solved]

Postby dudumomo » Sat Oct 27, 2012 5:19

Hello everyone,

I have installed a NFS share into my Debian server@home and would like to mount it on my HTPC running Sabayon.
The issue I am facing is:

1)When I mount the share with mount -t nfs4 ip:/share/share /where/iwant
No error but the where/iwant folder is empty.
2)If I try to umount, it say it is not mounted
3) If I try to remount again, I have a timeout...

If I try from another computer (Running Ubuntu), it works without anything particular.

For info, the Sabayon's firewall is not activated. Only the Debian server's firewall.

Any idea why?

Thank you !
Last edited by dudumomo on Wed Oct 31, 2012 13:04, edited 1 time in total.
Beedbox is a self-hosting distribution project with a web interface to configure all the services to ease it access.
Join us in this promising project!
----------------------------------------------------------------------------------
French mirror - freelydifferent.com
dudumomo
Growing Hen
 
Posts: 116
Joined: Tue Nov 16, 2010 14:40

Re: Unable to mount NFS share

Postby dudumomo » Tue Oct 30, 2012 6:04

Same thing from a liveUSB.

Any idea why?

Thank you !
Beedbox is a self-hosting distribution project with a web interface to configure all the services to ease it access.
Join us in this promising project!
----------------------------------------------------------------------------------
French mirror - freelydifferent.com
dudumomo
Growing Hen
 
Posts: 116
Joined: Tue Nov 16, 2010 14:40

Re: Unable to mount NFS share

Postby linuxfluesterer » Tue Oct 30, 2012 17:06

Hallo Dudumomo.
Exactly, you'll need to do some pre steps to use nfs, especially nfs4. Pls follow the steps in same sequence!
First is your Server, of course. You need to be root!
There you need to create one ore more new directories. Here my sample:
Code: Select all
mkdir /srv/nfs4/sda7
mkdir /srv/nfs4/sda10

Next step is to bind your directories to those new created directories, e.g.
Code: Select all
mount --bind /home/user/public  /srv/nfs4/sda7
mount --bind /mnt/Toshiba/Common /srv/nfs4/sda10

Next step is your /etc/exports file. Here you must enter the following lines:
Code: Select all
/srv/nfs4          192.168.0.0/16(rw,async,fsid=0,no_subtree_check,all_squash)
/srv/nfs4/sda7     192.168.0.0/16(rw,nohide,insecure,async,no_subtree_check)
/srv/nfs4/sda10    192.168.0.0/16(rw,nohide,insecure,async,no_subtree_check)

Be sure, your nfs-server is runnung!
Code: Select all
/etc/init.d/nfs-kernel-server start
(I think for debian, but in Sabayon it is /etc/init.d/nfs only)
You can check your nfs server export list with
Code: Select all
showmount -e

Now your (Sabayon) client. You need to be root, too.
Here you need to have installed nfs-utils (of course).
I'm not pretty sure, that you have to start it with
Code: Select all
/etc/init.d/nfs start

but if so, then you have every protocol you'll need to be client.
After you've started it, you should be able to mount your new nfs shares with:
Code: Select all
mount -t nfs 192.168.0.server_ip://srv/nfs4 /where/you/want

Watch, that you don't need to mount sda7 and sda10 itself!
It works, I just tried (with 2 Sabayones).

-Linuxfluesterer (I love KDE ... )
linuxfluesterer
Advanced Hen
 
Posts: 240
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: Unable to mount NFS share

Postby dudumomo » Wed Oct 31, 2012 4:31

Interesting.
I didn't bind the folders, just export them directly.
It is working with Ubuntu without issue but may be it is the issue with Sabayon...

I will try tonight.

Thank you !
Beedbox is a self-hosting distribution project with a web interface to configure all the services to ease it access.
Join us in this promising project!
----------------------------------------------------------------------------------
French mirror - freelydifferent.com
dudumomo
Growing Hen
 
Posts: 116
Joined: Tue Nov 16, 2010 14:40

Re: Unable to mount NFS share

Postby linuxfluesterer » Wed Oct 31, 2012 9:22

Hallo Dudumomo.
Binding is due to nfs4 and not because of Sabayon.
I used nfs4 with (K)ubuntu only before I used Sabayon since some years now.
Without Binding my mounted directory was empty...
And as I said before, I just tried nfs4 (with 2 Sabayones) yesterday and it worked fine.
Much success,

-Linuxfluesterer (I love KDE ...)
linuxfluesterer
Advanced Hen
 
Posts: 240
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: Unable to mount NFS share

Postby dudumomo » Wed Oct 31, 2012 12:52

I see.
It is actually the same problem, empty folder.

Let's try!

Edit:
BINGOOOO ! :mrgreen:

Thank you for this very clear tuto. (It would deserve an entry in the wiki !)

EDIT2:
And 1 new article to our beloved wiki:
https://wiki.sabayon.org/index.php?title=NFS
Beedbox is a self-hosting distribution project with a web interface to configure all the services to ease it access.
Join us in this promising project!
----------------------------------------------------------------------------------
French mirror - freelydifferent.com
dudumomo
Growing Hen
 
Posts: 116
Joined: Tue Nov 16, 2010 14:40

Re: Unable to mount NFS share [Solved]

Postby linuxfluesterer » Wed Oct 31, 2012 15:41

Hallo Dudumomo.
Thank you very much for that honour to create a wiki page and mention my name.
I've read it, and I needed to correct one line from:
Code: Select all
/etc/init.d/nfs-kernel-server start

to
Code: Select all
/etc/init.d/nfs start

because nfs-kernel-server is used for debian, not in Sabayon, as you correctly wrote in second (client) part.

I'm glad, thank you again.

-Linuxfluesterer (I love KDE ...) :D
linuxfluesterer
Advanced Hen
 
Posts: 240
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Re: Unable to mount NFS share [Solved]

Postby dudumomo » Wed Oct 31, 2012 15:45

Understood.

Thanks again !
Beedbox is a self-hosting distribution project with a web interface to configure all the services to ease it access.
Join us in this promising project!
----------------------------------------------------------------------------------
French mirror - freelydifferent.com
dudumomo
Growing Hen
 
Posts: 116
Joined: Tue Nov 16, 2010 14:40

Re: Unable to mount NFS share [Solved]

Postby Douglas_E_Knapp » Sat Nov 03, 2012 11:35

Can you please tell me why you have to create a new dir and why you have to bind it? Why can't you just export the real dir? Also why do you export nfs4 and then the 2 subdirs? Why not just the 2 sub dirs? Also I don't have /srv as part of my root dir collection. Should I create that too? Thanks!!

What I have so far. IT is not working on the importing computer (client). It is running a current Kubuntu. Exporter (server) has Sabayon 9. Any ideas?

Frog / # ls
bin dev home lib lib64 media opt root sbin sys usr
boot etc install-data lib32 lost+found mnt proc run srv tmp var
Frog / # mkdir srv/nfs4
Frog / # mkdir srv/nfs4/exportmediaA
Frog / # mkdir srv/nfs4/exportmediaB
Frog / # mount --bind /media/
BigOne/ KDE4Home/ Media/ ThreeT/
KDE3_Home/ .keep_sys-fs_udisks-0 NIKON D50/
Frog / # mount --bind /media/BigOne /srv/nfs4/exportmediaA
Frog / # mount --bind /media/ThreeT /srv/nfs4/exportmediaB
Frog / # vim /etc/exports
Frog / # /etc/init.d/nfs start
* WARNING: nfs has already been started
Frog / # /etc/init.d/nfs restart
* Stopping NFS mountd ... [ ok ]
* Stopping NFS daemon ... [ ok ]
* Unexporting NFS directories ... [ ok ]
* Exporting NFS directories ... [ ok ]
* Starting NFS mountd ... [ ok ]
* Starting NFS daemon ... [ ok ]
* Starting NFS smnotify ... [ ok ]
Frog / # showmount -e

etc/exports:
# /etc/exports: NFS file systems being exported. See exports(5).
#/media 192.168.2.0/24(rw,async,no_subtree_check)
/srv/nfs4 192.168.2.0/24(rw,async,fsid=0,no_subtree_check,all_squash)
/srv/nfs4/exportmediaA 192.168.2.0/24(rw,nohide,insecure,async,no_subtree_check)
/srv/nfs4/exportmediaB 192.168.2.0/24(rw,nohide,insecure,async,no_subtree_check)
Last edited by Douglas_E_Knapp on Sun Nov 04, 2012 8:06, edited 1 time in total.
Douglas_E_Knapp
Young Hen
 
Posts: 29
Joined: Sat Nov 03, 2012 8:53

Re: Unable to mount NFS share [Solved]

Postby linuxfluesterer » Sun Nov 04, 2012 0:42

Hallo Douglas.
NFS4 is handled different to nfs3, pls. take it as given.
I have got my knowledge from a German computer magazine, when I had the same problem.
This is (don't let me lie...) 2 years or more ago.
You can use any new directory you want, but in debian (K)ubuntu, /srv is already existing.
I used this /srv to work with different file server directories including nfs4.
The difference to nfs3 is, that when you mount ip://srv/nfs4, you mount all subdirectories in a run on your client.
That makes it much easier for clients. One mount only!
But for export the directories on the server, you MUST bind the main dir (/srv/nfs4) and the subdirs (/srv/nfs4/exportmediaA & B) before export.
If you export real directories, your mounted directories are empty, like Dudumomo has told us here before.
So, pls, try again with my detailed example or use the nfs wiki.
It works, if you follow strict.
Notice: Your /etc/exports file must not have old nfs and nfs4 entries mixed.
(Can you send me your /etc/exports file here?). And could you change to 192.168.0.0/16 for test, pls?
In Kubuntu you need to run some programs, also for client only. So, better anyway, install nfs-kernel-server on Kubuntu.
When this server is running, all programs (like portmap, rpc.bind and rpc.mountd) are started automatically.
And: you can mount the nfs shares on Kubuntu with
Code: Select all
mount -t nfs4 192.168.2.ip://srv/nfs4 /where/ever/you/want

Much success,

-Linuxfluesterer (I love KDE ...)
linuxfluesterer
Advanced Hen
 
Posts: 240
Joined: Thu Sep 20, 2012 19:47
Location: Germany

Next

Return to Networking and Wireless

Who is online

Users browsing this forum: No registered users and 1 guest

cron