Jump to content

Enabling NFS


Recommended Posts

It's been a while since I've tested and/or used this, but this was how I did it.

It's not the be all end all of methods.

 

You cannot export user filesystems via the initrootfs or user shares.

So I had to create a tmpfs that would be exportable via NFS.

 

I did this via two methods (one of which I can't quite find the script on how).

 

One method was to create a tmpfs on /mnt before emhttp was started.

I have not tested this in a really long time. It was just an experiment.

Try it out if you like.

 

Here's my mods to /boot/config/go

 

!/bin/bash
# Start the Management Utility

sleep 1 

if [ -e /proc/mdcmd ] 
   then echo trace > /proc/mdcmd; sleep 1
fi

# ------------------------------------------- #
# If noexeco is in syslink.cfg, 
# only do the following, then exit.
# ------------------------------------------- #
if grep -wq noexecgo /proc/cmdline
   then /boot/custom/etc/rc.d/S02-sync-etc
        /boot/custom/etc/rc.d/S20-install-sshd
        exit
fi

mount -t tmpfs -o size=1m,mode=0775 tmpfs /mnt

/usr/local/sbin/emhttp &

# the following is my script to run all custom startups on /boot
fromdos < /boot/custom/etc/rc.d/init.d/rc.local_startup | sh 

 

In my network, every host is mounted from a /hostname mount point with autofs.

This way what ever host I am on I can

 

cd /hostname/sharename

and get to that hosts nfs share.

autofs will mount the filesystem and unmount it when not in use.

This is relative to unix and not windows.

 

This script sets up the tmpfs mount point, exports file and symlinks.

It has to be run after installing the NFS support packages.

 

Somewhere in your go script you will need the following.

 

installpkg  /boot/custom/usr/share/packages/portmap-6.0-i486-1.tgz

installpkg  /boot/custom/usr/share/packages/nfs-utils-1.1.2-i486-1.tgz

 

 

This is my /boot/custom/etc/rc.d/S90-init.nfs

you will need to make adjustments to the export lines below according to your network and permissions.

Somewhere in your go script you will need to run this after installing the packages above.

 

You can use a line like.

fromdos < /boot/custom/etc/rc.d/S90-init.nfs | sh

 

 

#!/bin/bash

if [ ${DEBUG:=0} -gt 0 ]
   then set -x -v
fi

P=${0##*/}              # basename of program
R=${0%%$P}              # dirname of program
P=${P%.*}               # strip off after last . character
O=${P%_*}               # Operand
D=${P#${O}_}            # Data (last param before _ character)

H=`hostname`
mkdir /${H}
mount -t tmpfs -o size=1m,mode=0775 tmpfs /${H}

cat <<-EOF > /etc/exports
/${H} *.cotrone.com(rw,no_root_squash,no_subtree_check,nohide,fsid=0)
/boot *.cotrone.com(rw,no_root_squash,no_subtree_check,nohide)
EOF

for disk in /mnt/disk*
do  disk=${disk##*/}
    # echo mkdir ${disk}
    # echo mount -o bind /mnt/${disk} /${H}/${disk}
    echo "/mnt/${disk}  *.cotrone.com(rw,no_root_squash,no_subtree_check,nohide)" >> /etc/exports
    cd /${H}
    if [ ! -L ${disk} ]
       then ln -s /mnt/${disk} ${disk}
    fi
done

/usr/sbin/exportfs -va
/etc/rc.d/rc.nfsd restart

 

I would like to see how others have done it.

 

As far as using NFS on windows... I have very little experience with this.

Link to comment
  • 1 month later...

Thanks WeeboTech!

 

One problem I'm having is after doing a umount of any mounts of unraid drives on the linux client side, when I attempt to stop the unraid server via the web interface it doesn't return with a 'Reboot' button

 

On the unraid console I see the below messages. 

 

umount: /mnt/disk1: device is busy

rmdir: /mnt/disk1: Device or resource busy

 

The umount on the linux side gives no error message (ie appears to have gone fine) and I've tried confirming via subsequent 'umount -l' and 'umount -f' variations and get  'not mounted' messages on the client side, indicating it doesn't believe it has anything mounted.

 

Do you remember having this issue?

 

Any suggestions for a workaround?

 

 

 

Link to comment

You have to stop the nfs daemons fiirst.

 

what ever was started, has to be stopped in the reverse order.

/etc/rc.d/rc.nfsd stop

 

There might be others, Let me know if this works for you.

 

Do a

fuser -cu /mnt/disk1

or the associated disk to find the pids which might have files open on the disk.

example

 

root@Atlas ~ #fuser -cu /mnt/disk1
/mnt/disk1:          13882c(root) 13883cm(root) 15841c(root) 29866c(root) 29867cm(root)
root@Atlas ~ #ps -fp 13882 
UID        PID  PPID  C STIME TTY          TIME CMD
root     13882     1  0 Oct18 ?        00:00:13 /usr/bin/SCREEN -T linux -dmUS rTorrent /mnt/disk1/bittorrent/bin//rc.rTorrent run

 

Link to comment

You have to stop the nfs daemons fiirst.

 

what ever was started, has to be stopped in the reverse order.

/etc/rc.d/rc.nfsd stop

 

There might be others, Let me know if this works for you.

 

Thanks, that appears to do the trick. 

 

It would be cool to hook this into the script that runs when the 'Stop' button on the web interface is pushed for my particular application.

 

Any ideas on that?

Link to comment

You have to stop the nfs daemons fiirst.

 

what ever was started, has to be stopped in the reverse order.

/etc/rc.d/rc.nfsd stop

 

There might be others, Let me know if this works for you.

 

Thanks, that appears to do the trick. 

 

It would be cool to hook this into the script that runs when the 'Stop' button on the web interface is pushed for my particular application.

 

Any ideas on that?

 

A request for modification has been made to Lime-Technology to allow execution of user scripts upon events.

A received a nod for the possibility, but no timeframe.

It seems as time goes on, and we layer more services into the unRAID environment, this is becoming more important.

 

I surmise when Tom blesses NFS on unRAID, the functionality needed to stop NFS will be programmed.

 

Link to comment
  • 2 months later...

Sweet! I was just testing with ftp, windows shares (xp pro) and was going to test nfs next.

So far, it seems ftp is more steady, but you have to have two streams going to transfer at the max of 11-12MB/s with two files one of 12GB and one of 4 GB.

Same test with XP Pro shares to unraid Using Terra Copy gives me same speed roughly around 12MB/s fluctuating a lot more.

I am curious to see how nfs would behave.

 

Is ssh also built into unraid now?

 

Link to comment
  • 3 months later...

I am using the free version of unraid for testing as NFS backup server to use with Xenserver.

 

connecting with other NFS servers the is: server:/volume/share In the FAQ you use show an example: mount unraid:/mnt/user/photos

 

Question 1 since the free version does not have security for users would you use /mnt/root/photos

 

Question 2 how due fined the volume name?

Link to comment

I know almost nothing about NFS, but I don't think a different security model will affect how you set up the paths.  Why not try /mnt/user/photos, if you have User Shares turned on?

 

Others will know better, but I don't believe you have to worry about the Volume name.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...