How-to set a Linux NFS server-client share

daemonas

Registered
Messages
19
Following applies to linux NFS servers and clients.
We are installing nfs-kernel-server, nfs-common, portmap if not allready installed.
Next we are editing /etc/exports file on our server, as should be an access control list for filesystems which may be exported to NFS clients, e.g:

/DATA/music xxx.xxx.xxx.xxx(rw,no_root_squash,async,no_subtree_check)
;#; for read-write access, where xxx.xxx.xxx.xxx is our server's ip address,
or
/DATA/music xxx.xxx.xxx.xxx(ro,async,no_subtree_check)
;#; for read-only

We can export dirs for movies as well pictures the same way.
Also we can use other drives in net after mounting them in our server's described mount point.
We can use similar dir names, as, our multimedia player or our linux stb, uses.
Then we execute following commands as su

sudo exportfs -a
;#; for exporting fs to NFS clients
sudo /etc/nfs-kernel-server restart
;#; for starting NFS server service in our server.

That's all for server part, it works fine for me, using ubuntu server and busybox client (AZBox Premium ;-)

Next, assuming our client is ready to be nfs client, we are just mounting above mentioned server mounts, to similar empty ones in client, we have just created or allready existent.
Assuming we have installed an internal sata hdd in our client and we have lets say dir /DATA/hdb1/music on it, we are proceeding to final step after login in to client e.g:

telnet xxx.xxx.xxx.xxx ;#;ip-address.of.our.client
uid: ......
passwd: ........

mount xxx.xxx.xxx.xxx:/DATA/music /DATA/hdb1/music
;#; where xxx.xxx.xxx.xxx is our server's ip address

(In case we haven't internal hdd in client, we use exact the same mount point "/DATA/music", which by the way is default in azbox firmware.)
For security reasons, we can fix also hosts.allow & hosts.deny files in /etc :D :thum:

if everything's fine after a bit we can see our server's share.
that's all
Hope was helpfull

daemonas

PS:
huge thanks to thousands of web users who are always helping each other on learning almost everything...,
as well to "gorski" whose azbox alternative's guides, are always piece of art ;-)
 
Last edited:

gorski

Registered
Messages
1,553
Cheers, m8! :)

I am getting Synology NAS, so must try that one... When I manage - everybody who don't know how will be able to do it easily... :D
 

daemonas

Registered
Messages
19
How-to set a Linux NFS server-client share

We are installing nfs-kernel-server, nfs-common, portmap if not allready installed.
Must comment (#) loopback, in /etc/default/portmap in case its uncommented, or use following commands e.g:

sudo dpkg-reconfigure portmap
sudo /etc/init.d/portmap restart


Next we are editing /etc/exports file on our server, as should be an access control list for filesystems which may be exported to NFS clients, e.g:

/DATA/music xxx.xxx.xxx.xxx(rw,no_root_squash,async,no_subtree_check)
;#; for read-write access, where xxx.xxx.xxx.xxx is our server's ip address,
or
/DATA/music xxx.xxx.xxx.xxx(ro,async,no_subtree_check)
;#; for read-only

We can export dirs for movies as well pictures the same way.
Also we can use other drives in net after mounting them in our server's described mount point.
We can use similar dir names, as, our multimedia player or our linux stb, uses.
Then we execute following commands as su

sudo exportfs -a
;#; for exporting fs to NFS clients
sudo /etc/nfs-kernel-server restart
;#; for starting NFS server service in our server.

That's all for server part, it works fine for me, using ubuntu server and busybox client (AZBox Premium ;-)

Next, assuming our client is ready to be nfs client, we are just mounting above mentioned server mounts, to similar empty ones in client, we have just created or allready existent.
Assuming we have installed an internal sata hdd in our client and we have lets say dir /DATA/hdb1/music on it, we are proceeding to final step after login in to client e.g:

telnet xxx.xxx.xxx.xxx ;#;ip-address.of.our.client
uid: ......
passwd: ........


after connecting we may restart following services just to be sure e.g:

sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-common restart

then we mount shared point typing:

mount xxx.xxx.xxx.xxx:/DATA/music /DATA/hdb1/music
;#; where xxx.xxx.xxx.xxx is our server's ip address

(In case we haven't internal hdd in client, we use exact the same mount point "/DATA/music", which by the way is default in azbox firmware.)
For security reasons, we can fix also hosts.allow & hosts.deny files in /etc
if everything's fine after a bit we can see our server's share.

that's all
Hope was helpfull

daemonas

PS:
huge thanks to thousands of web users who are always helping each other on learning almost everything...,
as well to "gorski" whose azbox alternative's guides, are always piece of art ;-)

PS@gorski
Synology does great job !
 

gorski

Registered
Messages
1,553
Cool to know, thanx for the effort!!!!! :)

I must figure out what to do in Synology and what to do in AZbox HD but carefully, in detail, leaving nothing to the "imagination", as I am no expert, so I expect no one to be an expert and yet to be able to do it, after reading my guide...

Thanx again, for yet more material, for ye more learning!!!

If you can do more in detail stuff it would be great! You know, like PC in this case means PC with Linux OS, i.e. Ubuntu server.

In which case, when we are setting it up we must also do various other things, the stuff "experts" presume but non-experts find daunting... Ports, addresses, permissions and so on and so forth...

All the best, m8! :)
 

gorski

Registered
Messages
1,553
Btw, have you tried this, m8?

Mounting Wizard v1.3 by Daniel

This new plugin will help the users to mount nfs and samba servers in the AZBox. It auto-starts the mount points when the AZBox boots, contains some options to mount nfs, and its posible to mount samba with user and password.

If you find bugs, or you have any suggestion contact me.

To install just extract the files on the attachment "MW.zip" and copy those two files to some compatible pen or copy them to the /tmp folder by ftp and install.

-----------------------------------------
v1.1
New version with a bug fixed.
- user and password are now possible to modify on samba.

-----------------------------------------
v1.2
New version with capability to add folders inside local system folders.

-----------------------------------------
v1.3
New version with improvements and bugs fixed.
- few modifications on the interface.
- internal code improvements.
- bug that appeared when initializing nfs or samba with folders added to system folders.

© Dan

Would it be straight-forward or are there any tricks?

Cheers!:cool:
 

daemonas

Registered
Messages
19
Thnks gorski for bringing it (Daniel for creating it :) !
next free time I'll check it myself also, as it looks like
"swiss-army knife" for all of our "console hating" friends.
I'll be back asap
 

daemonas

Registered
Messages
19
@gorski
below inlined is an example of what mentioned commands do.
(As everybody knows, Linux magic exists in fact, that there are NO secrets for NOthing. As long as we have time and mood for reading everything keeps rolling ...) :clapping:

user@server:~$ sudo dpkg-reconfigure portmap
[sudo] password for user:
portmap stop/waiting
portmap start/running, process 2431
There are RPC services which were registered with the portmapper
before the configuration was changed.
You need to manually restart them in order for the changes to take effect.
Current registered services:
------------------------------------------------
100021 1 udp 51147 nlockmgr
100021 3 udp 51147 nlockmgr
100021 4 udp 51147 nlockmgr
100021 1 tcp 53548 nlockmgr
100021 3 tcp 53548 nlockmgr
100021 4 tcp 53548 nlockmgr
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100005 1 udp 59136 mountd
100005 1 tcp 45187 mountd
100005 2 udp 59136 mountd
100005 2 tcp 45187 mountd
100005 3 udp 59136 mountd
100005 3 tcp 45187 mountd
100024 1 udp 57266 status
100024 1 tcp 37549 status
------------------------------------------------

user@server:~$ cat /etc/default/portmap
# Portmap configuration file
#
# Note: if you manually edit this configuration file,
# portmap configuration scripts will avoid modifying it
# (for example, by running 'dpkg-reconfigure portmap').

# If you want portmap to listen only to the loopback
# interface, uncomment the following line (it will be
# uncommented automatically if you configure this
# through debconf).
# OPTIONS="-i 127.0.0.1"
 

gorski

Registered
Messages
1,553
Synology DS210j NAS problems with AZbox HD...

Errrmmmm.... no go.... :( :eek: :confused:

I set up the Synology DS210j properly, it is working GENERALLY but - not with AZbox HD specifically... Namely, I can access it from my PC but not from AZbox HD, Mounting Wizard or not [actually, it got confused at some point and the stuff I put into it got changed...]!

Interestingly, I can get in with AZbox HD's FTP Client! But I can not play anything from it, just move files [to the DOM, I think, because it froze quickly] etc.

But that won't do... When I try via Movies -> Network, for instance, it doesn't ask me for username/password and when it gets in the NAS - it can't see anything...

I activated the NFS server, as well as Windows one, created shared folders, given permissions [NFS one specifically, too!], added exceptions in the firewall, in the router and so on and so forth...

Nada! I am lost for words...:mecry:

Does anyone know EXACTLY how to mount NFS server's shared folders, put in the obviously necessary username/password and be able to stream to AZ HD from it, please?

But wait: my Windows7 has username and password but AZbox HD isn't asking for them in order to get in, and it still is able to go into Win7 shared folders and play from them! Weird or what?:rolleyes:

If it is possible, after all, to get into the NAS and play from it onto AZ HD: would it be possible to record onto a dedicated TV Record folder in the NAS, as opposed to a built-in HDD or a USB attached HDD???

Thanx in advance!:cool:
 

daemonas

Registered
Messages
19
gorski first of all, have best moments with your new beast :thum:
I haven't have it, a friend told about it and obviously its A+++!
Do not worry, you already know well that, first time procedures never go as meant to :(
Something missing obviously, but never the less Synology under Supported clients includes also "Ubuntu 9.04 onward".
AZB has not obviously Ubuntu 9.04, but there has to be some solution maybe a bit "hidden". I would suggest to do some "terminal" job, from AZB trying to mount 210's shared points. Also somewhere -do not remember where- saw something about using customized debian (or Ubuntu) on AZB. If nothing occurs give it a try too. Finally you'll do it m8. Curious to see the results
best regards :clapping:
 

daemonas

Registered
Messages
19
gorski, just tried Mounting Wizard v1.3 by Daniel as suggested. It runs FLAWLESS :thum:
thnks @daniel for plugin :clapping:
as a matter of fact, I suggest to give it a try with synology, as it may helps you a bit :)
greets :D
 

gorski

Registered
Messages
1,553
THANX, GUYS!!!

I was messing and messing with it until...

Heh, just discovered that in Win Server I haven't put the IP address and now CIFS works... [it seems...??]

But I can't tell which one actually works... I deleted the Mounting Wizard having tried it, as I stated earlier, which meddling left a few files behind and maybe they are working? Here is StartUpNFS from DISK2/etc:

Code:
192.168.x.x:/volume1/video /DATA/movie 1 0 1
192.168.x.x:/volume1//music /DATA/music 1 0 1
192.168.x.x:/volume1/photo /DATA/picture 1 0 1
192.168.x.x:/volume1/TV Record 1 0 1
/DATA/recordfile 0 0 0 0
These folders can't be seen via "Network" but by going directly into Movies, as it's being mounted right there!

It doesn't ask for username/password, even though I have them for the NAS.

Still, VOB is going great, MKV, too. Must test more...

Generally: IT'S WORKING!!!! :D

From my laptop [WLAN to the router and then LAN/cable] it wasn't as good. I had many more problems, then going straight via the LAN cables from the NAS! On top of that, lately I have mostly streamed from the USB HDD attached to my laptop. That made it even more difficult!

Anyways, as Zeini and co. said in their Wiki article: I can't record over the net to NAS, though, it seems... Here is a little online translation from German to English of the article:

The Network File System - NFS abbreviated (also Network File Service) - a system developed by Sun Microsystems protocol that allows access to files over a network. Process, the files are not transferred as in FTP, but the user can access files that reside on a remote computer, access, as if they were stored on their local hard drive. If NFS is UNIX network protocol.

The equivalent to NFS on Windows and OS / 2 environment is Server Message Block (SMB). While authenticated at the SMB user, authenticates the more popular the NFS V3 client machine, only NFS V4 allows user authentication.

NFS services are also available on Microsoft Windows servers, UNIX workstations, which may have access to their files. On Windows, a maximum possible NFS V3. However, it is mostly used in mixed environments with SMB Samba on Unixseite.

These instructions cover manual integration of network drives using NFS mounts.

Requirements:
- Telnet connection to your AZ-Box. How does this read here.
- NFS sharing a folder was created on a PC or NAS. On Windows, NFS shares can be realized only after installation of an NFS server. is used when a Windows PC without a NFS server, only the application of SMB mounts possible.

An NFS mount command is as follows.

Code:
mount -t nfs -o nolock,rsize=8192,wsize=8192 "IP-Adresse des PC":/Freigabename Mountziel
{Btw, Zeini explained: "NFS-Freigabe means NFS-Sharingname of the PC or NAS - in this example from the device with IP 192.168.0.2"}

In our example, the mount command looks like this:

Code:
mount -t nfs -o nolock,rsize=8192,wsize=8192 192.168.0.2:/Movies /DATA/movie
By entering this command via Telnet, the NFS share with the Movies folder / DATA movie / connected to the AZ box. The NFS share movies has been set up on the PC or the NAS with the IP address 192.168.0.2 before.

After successfully entering the Mount command via Telnet, are in the file manager on the AZ box mounted the files in the folder in the film, visible.

Code:
192.168.0.2:/Movies = NFS-Freigabe
, which you have established, for example, on your PC or NAS. 192.168.0.2 with the IP of the PC or NAS is in the network and Movies is the name of the share. The two information must be adapted to each of these events.

/DATA/movie = the destination on the AZBOX. In the case of "film".

Any number of NFS mounts are performed. Each mount command must however have a different target on the AZ-BOX. Multiple NFS mounts the directory / DATA / movie are not allowed. When multiple folders to be mounted with movies, there is the possibility subfolder in the / DATA / movie to create and to mount it.

You can create a subfolder, with, for example the name of movies in which you type the following commands:

Code:
mkdir /DATA/movie/Movies
This folder must be only once did he create will be retained after a restart of the Az-Box.

The mount command would look like this:

Code:
mount -t nfs -o nolock,rsize=8192,wsize=8192 192.168.0.2:/Movies /DATA/movie/Movies
Apart from "film" there's "music" and "Photos".
These folders can be mounted as follows:
Code:
Film = /DATA/movie 
Musik = /DATA/music 
Foto = /DATA/picture
It is not possible to mount a recording of the folder directly record to a network drive. How you can still take up to a network drive in post recording will be introduced to network drive.

However, the so prepared NFS mounts you can now set up permanent NFS-mounts via a startup script.
So, simply substitute, as to whatever you have named your folders, plus your correct NAS IP address and...

One more thing: I was trying the described manner of getting it started, so I was also using the PuTTy [Telnet] set of commands, as described.... Maybe that did it?

Dunno:eek: - must investigate to be able to do it again, when necessary... :rolleyes::D

Thanx a bunch!!!!!!!!!!!!!:thum:
 

gorski

Registered
Messages
1,553
It was the NFS procedure with Telnet [PuTTy] that did it in my case, thanx to Zeini & co.!!! Here it is again:

Code:
mount -t nfs -o nolock,rsize=8192,wsize=8192 192.168.x.x:/volume1/video /DATA/movie

mount -t nfs -o nolock,rsize=8192,wsize=8192 192.168.x.x:/volume1//music /DATA/music

mount -t nfs -o nolock,rsize=8192,wsize=8192 192.168.x.x:/volume1/photo /DATA/picture

mount -t nfs -o nolock,rsize=8192,wsize=8192 192.168.x.x:/volume1/TV Record /DATA/recordfile

This command mounts the folder into HOME -> Movie -> Movie as /DATA/movie and similarly will do with music or photos, of course...

But now I have to figure out how to do it automatically, so I don't have to do it every time I want to watch something... or restart/reboot AZbox HD...

Any takers for a statup NFS script, like the CIFS one here attached, please?

Thanx!!! :thum:
 

gorski

Registered
Messages
1,553
Daemonas, have a look, please...

Guys from the German support board said I must mount it directly, without the volume1 bit. So, I tried and reported back. This is the log:

Code:
AZBox[~]$ mount -t nfs -o nolock,rsize=8192,wsize=8192 192.168.1.253:/video /DATA/movie
mount: 192.168.1.253:/video failed, reason given by server: Permission denied

But when I do this:

Code:
AZBox[~]$ mount -t nfs -o nolock,rsize=8192,wsize=8192 192.168.1.253:/volume1/video /DATA/movie
mount: mounting 192.168.1.253:/volume1/video on /DATA/movie failed: Device or resource busy

...it does mount it to Movie -> Movie! Regardless of the message [I am copying files from USB HDD to NAS at the moment, so...], interestingly enough!

Long time ago I saw an NFS mount script. If memory serves it was in PLUGINS folder, pretending to be a PLUGIN...

So, could Daniel's Mounting Wizard do the job, after all, please? Anyone had managed to do it using his tool?:eek:

Any ideas, please?:confused:

Cheers!:cool:
 

gorski

Registered
Messages
1,553
Just noticed: the above thing with NFS NAS folders, mounted on AZbox HD, are mounted until one reboots.

If you put AZ to sleep it retains what you have done.

If you reboot, then you must re-do the commands with PuTTy...

It would still be great to get the script for auto-mounting of NFS shared folders...
 

daemonas

Registered
Messages
19
@gorski about daniel's plugin

Btw, have you tried this, m8?

Would it be straight-forward or are there any tricks?
Cheers!:cool:

ITS STRAIGHT-FORWARD JUST FTP IT TO AZBox /tmp

Then from plugins menu, add plugin and select from /tmp using provided list. After installation add info about local and remote mount points, activate it and its run like the river. You can't miss it, its just too IMPOSSIBLE :)
I told you you'll make it :thum:
have lot of fun and add it in a future new section of your guide ;)
 

gorski

Registered
Messages
1,553
I have already done all that, as you can see above, d...

But it didn't work.

So, I am asking your for specifics, details, exact manner of doing it... How PRECISELY have you done it?!?

Thanx!
 

gorski

Registered
Messages
1,553
This howto describes how to mount a NFS share with a plugin script.
It mounts the NFS shares to /DATA/movies /DATA/music etc
So you can select them via the menu of the AZbox.

Note: 192.168.x.xx = Ip of your NAS or server

Make a new folder in the OpenXCAS plugin directory on the Azbox, using for instance PuTTy:

Code:
cd /EMU/OpenXCAS
mkdir mount
cd mount

create a file in this folder with the name mount.sh with the following content:

Code:
#!/bin/sh
mount -t nfs 192.168.x.xx:/dir/to_your/video /DATA/movie -o nolock,soft,rsize=8192,wsize=8192
mount -t nfs 192.168.x.xx:/dir/to_your/music /DATA/music

Create a file called openxcas.conf in the same folder:

Code:
[module]
name = mount
daemon = mount.sh
version = 1.0

then chmod 755 * in the same folder to give the files execute rights.

Go up one folder into /EMU/OpenXCAS and add a line in the module.seq file called mount (a # in front of a line means the plugin is deactivated).

Then you can select the plugin in the OpenXCAS menu called mount and start it with the OK or yellow button.

You should see the new files in the Movie and Music menu entries.

if you already have a HDD this might conflict with existing /DATA mounts and a harddisk that you might have installed, it will not corrupt anything it just wont work

Thanks to emmanneil AND LilleMama

Here are the ABC instructions for Linux NFS stuff...

Code:
https://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/sysadmin-guide/s1-nfs-mount.html

Code:
http://docs.sun.com/app/docs/doc/817-5093/fsmount-69423?a=view

Code:
http://nfs.sourceforge.net/nfs-howto/

http://nfs.sourceforge.net/nfs-howto/ar01s04.html

4.3. Mount Options
4.3.1. Soft versus Hard Mounting

There are some options you should consider adding at once. They govern the way the NFS client handles a server crash or network outage. One of the cool things about NFS is that it can handle this gracefully. If you set up the clients right. There are two distinct failure modes:

soft

If a file request fails, the NFS client will report an error to the process on the client machine requesting the file access. Some programs can handle this with composure, most won't. We do not recommend using this setting; it is a recipe for corrupted files and lost data. You should especially not use this for mail disks --- if you value your mail, that is.
hard

The program accessing a file on a NFS mounted file system will hang when the server crashes. The process cannot be interrupted or killed (except by a "sure kill") unless you also specify intr. When the NFS server is back online the program will continue undisturbed from where it was. We recommend using hard,intr on all NFS mounted file systems.

Picking up from the previous example, the fstab would now look like:

# device mountpoint fs-type options dump fsckord
...
master.foo.com:/home /mnt/home nfs rw,hard,intr 0 0
...

The rsize and wsize mount options specify the size of the chunks of data that the client and server pass back and forth to each other.

The defaults may be too big or to small; there is no size that works well on all or most setups. On the one hand, some combinations of Linux kernels and network cards (largely on older machines) cannot handle blocks that large. On the other hand, if they can handle larger blocks, a bigger size might be faster.

Getting the block size right is an important factor in performance and is a must if you are planning to use the NFS server in a production environment. See Section 5, “Optimizing NFS Performance” for details.

Code:
http://www.freebsd.org/doc/handbook/network-nfs.html

There has to be a way!! Just look at this:

Code:
http://www.linuxconfig.org/HowTo_configure_NFS

Ubuntu:

Code:
http://www.cyberciti.biz/tips/ubuntu-linux-nfs-client-configuration-to-mount-nfs-share.html

Experts, help, please... :mecry:
 

gorski

Registered
Messages
1,553
I figured it out... I combined what Zeini & co. wrote on their Wiki site with BuyukBang's PM and made it work!

At the moment I am testing BuyukBang's new Priority Manager 1.8. One of the functions is automount NFS shared folders from external machines.

I figured a way different to what he had in mind but it works at my end... He needs to test it at his end first and then we'll see when more of you test if it is kinda universal...

From my Synology NAS [Linux OS] I simply activate NFS sharing, create Sharing Folders and then install and configure Priority Manager 1.8 and it all works really well, including VOB files [DVDs]. Must test more demanding mkv files. Already tried 720 and all was fine, more or less. Must find stuff with DTS sound...

Cheerio!:thum:
 
Top