DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

#1 2006-12-31 20:02:42

bingt
New member
From: Stockholm, Sweden
Registered: 2006-12-31
Posts: 3
Website

NFS Server

Hi all,
I have created a nfs-server package. Included is the nfsd.o kernel module, a portmap5 binary and binaries from nfs-utils 1.0.10. The server seems quite fast compared to the samba and ftp-server in the DSM-G600.

The server may be started with the following script inserted in the fun_plug file.

Change NFSROOT to the location where you unpacked the package. Also check the exports and hosts.* files created by the script to match your setup.

Code:

#!/bin/sh
# fun_plug example for nfs-server
# 

# Vars. Change these according to your setup
NFSROOT=/mnt/HD_a2/packages/nfs

# Set up needed directories and files
if [ ! -d $NFSROOT/var/lib/nfs ]
then
  mkdir -p $NFSROOT/var/lib/nfs
fi

if [ ! -d $NFSROOT/etc ]
then
  mkdir -p $NFSROOT/etc
fi

if [ ! -f $NFSROOT/etc/exports ]
then
 cat > $NFSROOT/etc/exports <<"EOF"
/mnt/HD_a2 192.168.1.0/24(rw)
EOF
fi

if [ ! -f $NFSROOT/etc/hosts.allow ]
then
 cat > $NFSROOT/etc/hosts.allow <<"EOF"
lockd: 192.168.1.*
rquotad: 192.168.1.*
mountd: 192.168.1.*
statd: 192.168.1.*
EOF
cat > $NFSROOT/etc/hosts.deny <<"EOF"
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
EOF

if [ ! -d /usr/sbin ]
then
 mkdir -p /usr/sbin
fi

# Make symlinks
ln -s $NFSROOT/etc/exports /etc/
ln -s $NFSROOT/var/lib /var/
ln -s $NFSROOT/etc/hosts.* /etc/
ln -s $NFSROOT/sbin/* /usr/sbin/

# start the server
/usr/sbin/insmod $NFSROOT/modules/nfsd.o
/usr/sbin/portmap
sleep 1
/usr/sbin/rpc.mountd
sleep 1
/usr/sbin/rpc.nfsd
sleep 1
/usr/sbin/rpc.statd
# re-export...
$NFSROOT/exportfs -ra

Last edited by bingt (2007-01-01 14:51:47)

Offline

 

#2 2007-02-07 05:27:46

brdhse1
Member
Registered: 2007-02-07
Posts: 7

Re: NFS Server

I realize that this is the DSM-G600 forum, but i'm going to give it a shot anyway...

I have the DNS-323 and I would really like to run your NFS server on it.  I placed your files in the correct location and I added your script to my fun_plug.  The script, however, seems to be failing on this line: "/usr/sbin/insmod $NFSROOT/modules/nfsd.o".  when I execute that line, I get this error: "insmod: error inserting '/mnt/HD_a2/packages/nfs/modules/nfsd.o': -1 Invalid module format"

Do you have any idea why I would be getting this or how to adapt this for the DNS-323?  Any help would be much appreciated.

Cheers!

Offline

 

#3 2007-02-07 16:51:19

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: NFS Server

Bought my DNS-323 yesterday. I'm also very interested in installing an NFS server. I called D-Link on that, but they wont provide any assistance, and also have no plans to include an NFS server into future firmware releases.

brdhse1: The problem with this approach is that the DNS likely runs a different linux kernel than the DMS. You need to get a nfsd kernel module specifically made for the DNS-kernel. For this, you need to setup the development environment, and compile your own NFS-Kernel module. Alternatively, one might find a nice user-space NFS server, which might simplify things...

Offline

 

#4 2007-02-07 18:27:10

Paul
Member
From: Landshut, Germany
Registered: 2007-01-19
Posts: 35
Website

Re: NFS Server

well, the DSM-G600 is ppc-based (I think), and the DNS-323 is arm based... so you will even need a different nfs & portmap binary...

but if you're about to recompile it... here's a nfsd.ko for the dns323 http://dev.skcserver.de/dns323/nfsd.ko.
The module loads perfectly into the running kernel, but, when using the nfs-kernel-server package from debian etch, the dlink freezes when accessing files via nfs :-( That's why I'm sticking to the nfs-user-server, which works! It doesn't even need the kernel module...

Offline

 

#5 2007-02-07 23:58:31

brdhse1
Member
Registered: 2007-02-07
Posts: 7

Re: NFS Server

Lipovitan:

Where can i get the nfs-user-server?  Do you have any instructions on how to use this?

Cheers!

Offline

 

#6 2007-02-08 05:30:22

pcooley
New member
Registered: 2007-02-08
Posts: 1

Re: NFS Server

I have the nfs service running on my DSM-G600 thanks to bingt's instructions and binaries.  Kudos.

However, I discovered a couple of typos in the fun_plug excerpt above. (1) a missing 'fi' and (2) a missing 'sbin' in the exportfs path and (3) the incorrect path to the insmod executable.  The below is my currently running piece of fun_plug script.  It appears to be working well.

Code:

# nfs server
# Vars. Change these according to your setup
NFSROOT=/mnt/HD_a2/nas_packages/nfs

# Set up needed directories and files
if [ ! -d $NFSROOT/var/lib/nfs ]
then
  mkdir -p $NFSROOT/var/lib/nfs
fi

if [ ! -d $NFSROOT/etc ]
then
  mkdir -p $NFSROOT/etc
fi

if [ ! -f $NFSROOT/etc/exports ]
then
 cat > $NFSROOT/etc/exports <<"EOF"
/mnt/HD_a2 192.168.0.0/24(rw)
EOF
fi

if [ ! -f $NFSROOT/etc/hosts.allow ]
then
 cat > $NFSROOT/etc/hosts.allow <<"EOF"
lockd: 192.168.0.*
rquotad: 192.168.0.*
mountd: 192.168.0.*
statd: 192.168.0.*
EOF
cat > $NFSROOT/etc/hosts.deny <<"EOF"
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
EOF
fi

if [ ! -d /usr/sbin ]
then
 mkdir -p /usr/sbin
fi

# Make symlinks
ln -s $NFSROOT/etc/exports /etc/
ln -s $NFSROOT/var/lib /var/
ln -s $NFSROOT/etc/hosts.* /etc/
ln -s $NFSROOT/sbin/* /usr/sbin/

# start the server
/sbin/insmod $NFSROOT/modules/nfsd.o
/usr/sbin/portmap
sleep 1
/usr/sbin/rpc.mountd
sleep 1
/usr/sbin/rpc.nfsd
sleep 1
/usr/sbin/rpc.statd
# re-export...
$NFSROOT/sbin/exportfs -ra

Paul Cooley
http://linuxlore.blogspot.com

Offline

 

#7 2007-02-10 11:53:07

bingt
New member
From: Stockholm, Sweden
Registered: 2006-12-31
Posts: 3
Website

Re: NFS Server

Glad to hear it is useful. Good job fixing the script, it was just out of my head late at night.

I have also compiled a 1.3.0 busybox binary with syslog support (makes most things, including the nfs server more traceable) and a needed unix.o (Unix domain sockets) kernel module.

Just put the attached busybox binary in $FUNROOT/bin and the unix.o in your favorite modules directory.

Code:

# Change these according to your setup...
FUNROOT="/mnt/HD_a2"
MODULES="$FUNROOT/lib/modules"

# Syslog 
if [ ! -e $FUNROOT/var/log/messages ]
then
  mkdir -p $FUNROOT/var/log
  touch $FUNROOT/var/log/messages
  chmod 700 $FUNROOT/var/log/messages
fi
ln -s $FUNROOT/var/log/messages /var/log/

if [ ! -e $FUNROOT/usr/sbin/syslogd ]
then
  ln -s $FUNROOT/bin/busybox $FUNROOT/usr/sbin/syslogd
  ln -s $FUNROOT/bin/busybox $FUNROOT/usr/sbin/klogd
fi

/sbin/insmod $MODULES/unix.o
$FUNROOT/usr/sbin/syslogd -O $FUNROOT/var/log/messages
$FUNROOT/usr/sbin/klogd

Last edited by bingt (2007-02-10 11:59:09)

Offline

 

#8 2007-09-15 00:26:50

tsmalmbe
Member
From: Finland
Registered: 2007-09-15
Posts: 7
Website

Re: NFS Server

Regarind the new busybox with syslog: I can get the syslog to work, but my telnetd (and my tty for ssh) stops working. What am I doing wrong? I added yout lines to my fun_plug, but kept the basic commands involving busybox (like cd /dev && /mnt/HD_a2/busybox makedevs ptyp c 2 0 0 9 and  cd /dev && /mnt/HD_a2/busybox  makedevs ttyp c 3 0 0 9).

Offline

 

#9 2007-09-16 12:27:59

SystemR89
Member
From: >>Turin<< >>Italy<<
Registered: 2006-09-19
Posts: 88

Re: NFS Server

tsmalmbe wrote:

Regarind the new busybox with syslog: I can get the syslog to work, but my telnetd (and my tty for ssh) stops working. What am I doing wrong? I added yout lines to my fun_plug, but kept the basic commands involving busybox (like cd /dev && /mnt/HD_a2/busybox makedevs ptyp c 2 0 0 9 and  cd /dev && /mnt/HD_a2/busybox  makedevs ttyp c 3 0 0 9).

You need to have two busybox binary because in the second (busybox with syslog) is not integrated telnetd and dropbear.


Free is BETTER!!
Use GNU/Linux!!

Offline

 

#10 2007-09-18 00:07:52

tsmalmbe
Member
From: Finland
Registered: 2007-09-15
Posts: 7
Website

Re: NFS Server

I tried this as follows: I used my "old" busybox as I always have, and then I added your busybox as busybox-syslog. But syslog doesn't work. If i use busybox as the shell etc., syslogging works OK.

Offline

 

#11 2007-09-18 17:26:24

SystemR89
Member
From: >>Turin<< >>Italy<<
Registered: 2006-09-19
Posts: 88

Re: NFS Server

tsmalmbe wrote:

I tried this as follows: I used my "old" busybox as I always have, and then I added your busybox as busybox-syslog. But syslog doesn't work. If i use busybox as the shell etc., syslogging works OK.

Someone should recompile a new busybox all-in-one...


Free is BETTER!!
Use GNU/Linux!!

Offline

 

#12 2007-09-20 00:33:55

tsmalmbe
Member
From: Finland
Registered: 2007-09-15
Posts: 7
Website

Re: NFS Server

Yes please!

Offline

 

#13 2007-10-04 00:00:44

tsmalmbe
Member
From: Finland
Registered: 2007-09-15
Posts: 7
Website

Re: NFS Server

Right, don't know what I did, just ran the commands manually from the command line, and now the syslog seems to work. Can I use this syslog from external sources also?

Offline

 

#14 2007-12-28 10:23:43

sala
Member / Site Admin
From: Estonia
Registered: 2006-07-28
Posts: 731
Website

Re: NFS Server

Can someone re-upload nfs-utils-1.0.10-portmap5-nfsd.tar.gz and busybox-1.3.0-unix.tar.bz2 please?
Tnx!


DSM-G600 - NetBSD hdd-boot - 80GB Samsung SP0802N
NSA-220 - Gentoo armv5tel 20110121 hdd-boot - 2x 2TB WD WD20EADS

Offline

 

#15 2007-12-30 00:01:23

nikosan
New member
From: France
Registered: 2007-12-29
Posts: 1

Re: NFS Server

I have nfs-utils-1.0.10-portmap5-nfsd.tar.gz but not busybox-1.3.0-unix.tar.bz2
Can someone re-upload busybox-1.3.0-unix.tar.bz2 ?

Thanks !


Attachments:
Attachment Icon nfs-utils-1.0.10-portmap5-nfsd.tar.gz, Size: 274,746 bytes, Downloads: 586

Offline

 

#16 2007-12-30 15:21:19

SystemR89
Member
From: >>Turin<< >>Italy<<
Registered: 2006-09-19
Posts: 88

Re: NFS Server

nikosan wrote:

Can someone re-upload busybox-1.3.0-unix.tar.bz2 ?

this is the binary

EDIT

ops.. it's too big.. I uploaded it in my directory: http://download.dsmg600.info/people/SystemR89/busybox2

Last edited by SystemR89 (2007-12-30 15:26:35)


Free is BETTER!!
Use GNU/Linux!!

Offline

 

#17 2008-02-04 00:41:38

xunil
New member
Registered: 2007-10-08
Posts: 1

Re: NFS Server

Hello

I tried to share my disk with nfs (for a dreambox)  i can't mount the share from my dm, my mac (with finder or terminal)

i copy the script from this page & adapt it with my network, the telnet works

can you help me ?

Offline

 

#18 2008-03-23 16:59:44

noobish
New member
Registered: 2008-03-14
Posts: 2

Re: NFS Server

Does anyone have unix.o module somewhere? Link to busybox-1.3.0-unix.tar.bz2 seems to be broken.

Offline

 

#19 2008-03-24 10:56:10

SystemR89
Member
From: >>Turin<< >>Italy<<
Registered: 2006-09-19
Posts: 88

Re: NFS Server


Free is BETTER!!
Use GNU/Linux!!

Offline

 

#20 2008-05-05 15:12:09

SiTLar
New member
Registered: 2008-01-06
Posts: 4

Re: NFS Server

Hi!

I'm trying to make working nfsd on TS-I300. After some patching I've managed to compile it with uclibc gcc-3. However when running exportfs -ra I receive a segmentation fault.

Here what I get from dmesg:

Code:

 <1>Unable to handle kernel paging request at virtual address fffffffc
 printing eip:
c01158ac
*pde = 00009063
*pte = 00000000
Oops: 0000
CPU:    0
EIP:    0010:[<c01158ac>]    Not tainted
EFLAGS: 00000013
eax: c2c9f844   ebx: 00000000   ecx: 00000001   edx: 00000003
esi: c2c9f844   edi: 00000003   ebp: c1acdf5c   esp: c1acdf48
ds: 0018   es: 0018   ss: 0018
Process exportfs (pid: 27832, stackpage=c1acd000)
Stack: 00000001 00000296 c048b4b0 00000000 00000000 00000029 c2c96172 c2c96395
       c0148a05 c048b4b0 00000000 c048b4c8 00000000 00000000 00000000 00000000
       00000000 00000000 c098d270 ffffffea 00001000 c0133533 c098d270 08055d78
Call Trace:    [<c2c96172>] [<c2c96395>] [<c0148a05>] [<c0133533>] [<c01087cf>]

Code: 8b 53 fc 8b 02 85 c7 75 13 8b 1b 39 f3 75 f1 ff 75 f0 9d 8d

I hope that the problem is not in the kernel.

One suspicious thing: my exportfs is 10 times larger then the file from the DSM-G600 package. Any suggestions?

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB