New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

Kernel based nfs server

Good ideas? Share with us!
6feet5
Posts: 269
Joined: 13 Apr 2007, 17:32
Location: Gnesta, Sweden
Contact:

Post by 6feet5 »

Why don't you all do it yourself? This is open source you know ;-)

Here's a rough step by step on how to compile your own kernel module for NFS server support.
  • First note:
    So far, I haven't been able to make this work. Should you do, let the rest of us know. After all, that is what this community is all about.
    EDIT:Some sleep made it all clearer and it is now working.
  • Second note:
    I accept no liability should your bubba go up in flames, become a brick or what ever bad thing you can think of. In other words, YOU ARE ON YOUR OWN (but you have my sympathy ;-))!!
  • Third note:
    Your bubba is most likely far from as fast as your desktop computer. This means compiling will take time, and a lot of it. Remember, patience a virtue. All good things come to he who waits (yeah, right, but you get my drift, right....)
  • Fourth note:
    There may/will be errors during the build. I ignored/worked around them, you have to decide if you dare to.
  • Fifth and last note (really, this is the last one)
    I've modified my B2 so I may have packages installed that you don't, in other words, your mileage may vary. You may have to install packages I've forgotten to mention.
Prerequisite
These are the packages that I know for sure you need to install before trying anything else:
- bzip2
- build-essential
- less (ok, so this is not really essential but will enhance your 'man' experience)

Each package is installed using:

Code: Select all

apt-get install <pkg-name>
where <pkg-name> is the package name.


And now that we are prepared, off we go:

1. Log on to your bubba using your favourite SSH client.

2. Get the linux kernel source:

Code: Select all

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.5.tar.bz2
EDIT: I wouldn't use this for anything like replacing the existing kernel or other important parts. There are probably patches that need to be installed to get a fully working kernel.

3. Decompress it:

Code: Select all

tar xjf linux-2.6.26.5.tar.bz2
Note that your bubba is much slower than your average desktop computer, so give it some time to finish the command before you decide to throw it out the window, reboot it, or what ever desperate action you may take (hey, throw it in my direction :-)). It is better to add a 'v' to the option list (xjf) so that you see what it is actually doing (but this will make it go even slower).

4. Enter kernel source folder:

Code: Select all

cd linux-2.6.26.5
5. Copy current kernel configuration:

Code: Select all

cp /proc/config.gz .
6. Decompress configuration:

Code: Select all

gunzip config.gz
7. Copy to default settings:

Code: Select all

cp config .config
8. Edit settings (.config) in your favourit editor:

Code: Select all

vim .config
9. Locate the NFSD part and enable it as a module:

Code: Select all

# CONFIG_NFSD is not set
should become

Code: Select all

CONFIG_NFSD=m
10. Compile the modules:

Code: Select all

make modules
Note that this will take time on your bubba, I'm not kidding, make yourself a good cup of coffee and watch a good movie, paint drying or what ever your preferences are, but be prepared to wait.
EDIT: I forgot to mention that you will get some questions about parts of NFS you want support for. I chose to install all that wasn't marked as experimental.

11. Ok, so the movie has ended and the compiling as well, but what the..., an error on crtsavres.o. Fear not:

Code: Select all

make arch/powerpc/lib/crtsavres.o
12. Being stubborn, we accept no failure. Hit it again:

Code: Select all

make modules
(The impatiant one can break with CTRL-C when nfsd.ko, exportfs.ko and nfs_common/nfs_acl.ko modules have been built). The rest will wait (you can always continue with 'make modules' if you were to quick to cancel).

13. And now everything should be complete. We need to copy the files to the right folders. You need root privilegies for this:

Code: Select all

mkdir /lib/module/`uname -r`/kernel/fs/nfsd
mkdir /lib/module/`uname -r`/kernel/fs/exportfs
mkdir /lib/module/`uname -r`/kernel/fs/nfsd_common
cp fs/nfsd/nfsd.ko /lib/kernel/`uname -r`/kernel/fs/nfsd
cp fs/exportfs/exportfs.ko /lib/module/`uname -r`/kernel/fs/exportfs
cp fs/nfs_common/nfs_acl.ko /lib/module/`uname -r`/kernel/fs/nfs_common
14. Last and final step. Resolve all loose ends:

Code: Select all

depmod -a
15. And finally install it:

Code: Select all

modprobe nfsd
16. No visual errors? Verify it is loaded:

Code: Select all

dmesg
lsmod
And there you have it, kernel module in place :-)
All you need to do next is to install nfs-kernel-server, that should also install nfs-common. Configure the /etc/exports (man exports, for help), /etc/hosts.[deny|allow] (man hosts_access, for help) and you should be up and running. Test it by running:

Code: Select all

rpcinfo -p
You should get a list where nfs is among the entries.

A faster route would probably be to install a cross-compiler on your desktop computer and compile it there, but I'll save that instruction for a rainy day. The impatient may find interesting stuff at: http://kegel.com/crosstool and http://www.google.com ;-) Oh, and all this is a whole lot easier on a linux machine. Cross compiling linux kernel stuff on a windows machine is not for the average user, trust me...(hell, it's not even for the experienced one)

Another route is to compile only the missing module, but I haven't figured out how to do that. That is, I thought

Code: Select all

make SUBDIRS=fs/nfsd modules
would do the trick but I got an error on the bubba that didn't appear in my cross-compiling environment. Haven't figured out why yet, but hey, it is working though it took some time :-)

/Johan
helder
Posts: 24
Joined: 17 Jun 2007, 16:21

Post by helder »

6feet5 wrote:Why don't you all do it yourself? This is open source you know ;-)
It did work! - Thank you . It seems that Excito didn't change the header files very much otherwise I think this procedure wouldn't work.

Just a few notes:
  • Besides changing "# CONFIG_NFSD is not set" to "CONFIG_NFSD=m" in the .config file we are asked a few questions while compiling, this is because we are missing some configurations on the .config file. The net result is that the "# CONFIG_NFSD is not set" is changed to

    Code: Select all

    CONFIG_NFSD=m
    CONFIG_NFSD_V2_ACL=y
    CONFIG_NFSD_V3=y
    CONFIG_NFSD_V3_ACL=y
    Maybe I should have set CONFIG_NFSD_V2_ACL to no.
  • It was not necessary to do the all the "make modules" compilation. To compile the needed modules I've only had to:

    Code: Select all

    $ make fs/nfsd/nfsd.ko
    $ make fs/exportfs/exportfs.ko
    $ make fs/nfs_common/nfs_acl.ko
    This takes only a few brief minutes to do, even on Bubba. (It does need "crtsavres.o" compiled, so the first make fails and we have to compile this file just as you suggest.)
  • Finally you have some typos on the "install" code, the correct version is:

    Code: Select all

    mkdir /lib/modules/`uname -r`/kernel/fs/nfsd
    mkdir /lib/modules/`uname -r`/kernel/fs/exportfs
    mkdir /lib/modules/`uname -r`/kernel/fs/nfs_common
    cp fs/nfsd/nfsd.ko /lib/modules/`uname -r`/kernel/fs/nfsd
    cp fs/exportfs/exportfs.ko /lib/modules/`uname -r`/kernel/fs/exportfs
    cp fs/nfs_common/nfs_acl.ko /lib/modules/`uname -r`/kernel/fs/nfs_common
Helder
6feet5
Posts: 269
Joined: 13 Apr 2007, 17:32
Location: Gnesta, Sweden
Contact:

Post by 6feet5 »

helder wrote:
  • It was not necessary to do the all the "make modules" compilation. To compile the needed modules I've only had to:

    Code: Select all

    $ make fs/nfsd/nfsd.ko
    $ make fs/exportfs/exportfs.ko
    $ make fs/nfs_common/nfs_acl.ko
    This takes only a few brief minutes to do, even on Bubba. (It does need "crtsavres.o" compiled, so the first make fails and we have to compile this file just as you suggest.)
Funny, I tried that too (and that SUBDIRS part I mentioned), but I got errors saying make couldn't find the targets.
I tried it again now and now it's working. It must have been a typo on my part. You can of course build it all in one go:

Code: Select all

make arch/powerpc/lib/crtsavres.o fs/nfsd/nfsd.ko fs/exportfs/exportfs.ko fs/nfs_common/nfs_acl.ko
helder wrote:
  • Finally you have some typos on the "install" code, the correct version is:

    Code: Select all

    mkdir /lib/modules/`uname -r`/kernel/fs/nfsd
    mkdir /lib/modules/`uname -r`/kernel/fs/exportfs
    mkdir /lib/modules/`uname -r`/kernel/fs/nfs_common
    cp fs/nfsd/nfsd.ko /lib/modules/`uname -r`/kernel/fs/nfsd
    cp fs/exportfs/exportfs.ko /lib/modules/`uname -r`/kernel/fs/exportfs
    cp fs/nfs_common/nfs_acl.ko /lib/modules/`uname -r`/kernel/fs/nfs_common
Oops.. :oops: late night hacking has its disadvantages.;-)

/Johan
carl
Posts: 474
Joined: 07 May 2008, 04:41

Post by carl »

efolch wrote:just another me too

nfs-kernel is plain better that nfs-user

cheers
k
We will enable kernel nfsd support in upcoming update, hopefully in the coming week.

/Carl
/Carl Fürstenberg, Excito Software Developer
http://www.excito.com
support@excito.com
maxol
Posts: 2
Joined: 09 Oct 2008, 21:11

Post by maxol »

carl wrote:
We will enable kernel nfsd support in upcoming update, hopefully in the coming week.

/Carl
Good news, thankyou.
whilbone
Posts: 25
Joined: 22 Oct 2008, 03:09

Post by whilbone »

Great... I was almost ready to get started on the instructions above but I'm not that much in a rush so I'll just sit tight and wait...
jonj1
Posts: 51
Joined: 24 Oct 2008, 15:33

Post by jonj1 »

me too!
whilbone
Posts: 25
Joined: 22 Oct 2008, 03:09

Post by whilbone »

We will enable kernel nfsd support in upcoming update, hopefully in the coming week.

/Carl
Any news on this?
ahoff
Posts: 105
Joined: 01 Apr 2008, 20:50
Location: Swe

Post by ahoff »

We will enable kernel nfsd support in upcoming update, hopefully in the coming week.

/Carl
Long weeks in Skåneland :wink:? I did it the "6feet5" way. Took me 15 min. Works great :), tanx.
Last edited by ahoff on 02 Aug 2013, 04:24, edited 1 time in total.
carl
Posts: 474
Joined: 07 May 2008, 04:41

Post by carl »

Hehe, we have reealy long weeks here :)
No all our time last weeks have gone creating the recently released bugfix for the bootloader. We are working now on straighting out the last bugs before new update.

/Carl
/Carl Fürstenberg, Excito Software Developer
http://www.excito.com
support@excito.com
paolol61
Posts: 99
Joined: 20 Nov 2007, 04:18

Post by paolol61 »

up up.
just to make sure you remeber us :D :D
8)
Cohan
Posts: 21
Joined: 12 Aug 2008, 15:42

Post by Cohan »

Is the official support for NFS here yet?
franklinhyde
Posts: 1
Joined: 18 Jul 2009, 06:09

Re:

Post by franklinhyde »

Cohan wrote:Is the official support for NFS here yet?
Any one care to answer this?
ahoff
Posts: 105
Joined: 01 Apr 2008, 20:50
Location: Swe

Re: Kernel based nfs server

Post by ahoff »

Cohan wrote:Is the official support for NFS here yet?
Yes it is.
http://forum.excito.net/viewtopic.php?f=1&t=1685
Åke Hoff
Örskogen
Sweden
jonj1
Posts: 51
Joined: 24 Oct 2008, 15:33

Re: Kernel based nfs server

Post by jonj1 »

Thanks to the original posters in this thread for instructions to get NFS running (before it was included in the bubba2 kernel).

I've posted here http://forum.excito.net/viewtopic.php?f ... 08&start=0 about increasing transfer speed by using UDP, may be helpful to some.
Post Reply