Author Topic: NFS media share mounting experience & issues  (Read 9443 times)

schaferj

  • Veteran
  • ***
  • Posts: 133
    • View Profile
NFS media share mounting experience & issues
« on: February 24, 2009, 01:51:19 am »
Hello,
I appreciate any advice on solving a file share issue I’ve been wrestling with for several weeks.
Bottom-line-up-front is I’d like advice on using NFS. 
Is it correct that nfs shares (unlike smb/cifs shares) must be installed manually via the webgui?

I’ve had qualified success which I’ll describe below.  NFS shares do not seem to be auto discovered and mounted like samba shares.

I’d like to get this solved and then add to the wiki.

I followed the advice at in the New Media Navigation Facility thread by Roy at
http://forum.linuxmce.org/index.php?topic=5054.0
and the wiki at:
http://wiki.linuxmce.com/index.php/Howto:_Using_Network_Shares#NFS_Server_Hints
(with exceptions since my server was solaris with zfs / nfs instead of linux)

I also looked at trying to force a persistent mount with messagesend, but did not pursue.
http://wiki.linuxmce.com/index.php/MessageSend

Background:
I succeeded in copying about 1.5TB of videos to a new NAS with a smb / cifs share.  However it had intermittent issues and I had trouble with the share disappearing and since my server could do nfs as easily as smb / cifs, I decided to try nfs.
(The smb share failure was unrelated to linuxmce – if interested see http://www.nexenta.com/corp/index.php?option=com_fireboard&Itemid=44&func=view&catid=11&id=&id=729&catid=11  )
I’m going to split the details into several posts
  • This is Post 1
    Post 2 is how I set up zfs / nfs share on the server
    Post 3 is how I mounted on linuxmce
    Post 4 is an attempt at manually mounting in a new mount point

thanks,
joseph

schaferj

  • Veteran
  • ***
  • Posts: 133
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #1 on: February 24, 2009, 01:53:28 am »
Post 2 – how I set up zfs / nfs based on the wiki & forum advice

NFS options should be (async,no_subtree_check,rw,no_root_squash) and
ownership in your share of media files should be: root:public (0:1002) and permissions should be set to 2775 (rwxrwsr-x)

On my server, I checked to make sure no conflicts then
Quote
root@nexo:~ # groupadd –g 1002 public
root@nexo:~ # groupadd -g 1002 public
root@nexo:~ # cat /etc/group | grep 1002
public::1002:

Then I double checked ownership & permissions:
Quote
root@nexo:~# ls -lash /pool3/
2.0K drwxrwsr-x  6 root   public  8 Feb 11 03:15 rare
root@nexo:~#

Then create the NFS share (“root=” is the same as no_root_squash)
Quote
root@nexo:~# zfs set sharenfs=rw,root=192.168.80.1,anon=0  pool3/rare

Then check shares
Quote
root@nexo:~# sharemgr show -vp
default nfs=()
zfs
    zfs/pool3/rare nfs=(anon="0") nfs:sys=(rw="*" root="192.168.80.1")
          /pool3/rare
root@nexo:~#

then attempted to mount on linuxmce core - details in next post,
joseph

schaferj

  • Veteran
  • ***
  • Posts: 133
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #2 on: February 24, 2009, 01:55:32 am »
Post 3 is how I mounted on linuxmce - Adding NFS shares:

The new nfs server was not auto discovered, so I manually created the file server device in the webgui.  Also, no shares were auto discovered and so I tried Configure_1837.sh, but that did not find shares and it had permission issues – and I think it’s only for SMB shares.

Quote
linuxmce@dcerouter:~$sudo /usr/pluto/bin/Configure_1837.sh -d 123
Sat, 21 Feb 2009 17:41:00 -0800 Called to configure Device : 123
Error connecting to 192.168.80.228 (Connection refused)

So I manually created the nfs share device in the webgui also.  And tried Configure_1769.sh to force the link creation.
Quote
linuxmce@dcerouter:~$sudo /usr/pluto/bin/Configure_1769.sh -d 124
Configure_1769.sh worked, and changing the device in the webgui was reflected properly in the behavior of Configure_1769.sh.  For instance, changing webgui device 124 from Pluto Structure to Public created the links in either the various directories OR /home/public/data/other as appropriate when Configure_1769.sh is run.  Output snippet:
Quote
Sun, 22 Feb 2009 10:15:19 -0800 Generating symlinks for storage device nexoNFS-Share-rare124 (124)
/home/public/data/other/nexoNFS-Share-rare124 [124] -> /mnt/device/124/

So, it worked! 
However, the share would just go away.  It just vanished and I thought perhaps the automounter had an issue so I manually mounted it.  That worked also:
Quote
linuxmce@dcerouter:~$ sudo mount -t nfs 192.168.80.228:/pool3/rare /mnt/device/124

But it would unmount also.  I added the appropriate line in /etc/fstab, and again, it would mount, and then it would umount.

So I thought that maybe linuxmce was forcing an unmount for some reason and decided to see if I could mount it somewhere else and link it back in.

So I deleted the devices and links and commented out the related /etc/fstab mount line and attempted to create a new manual mount point – details in next post.
Thanks,
joseph

schaferj

  • Veteran
  • ***
  • Posts: 133
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #3 on: February 24, 2009, 01:57:51 am »
Post 4 is an attempt at manually mounting in a new mount point

So, create a new mount point
Quote
linuxmce@dcerouter:/mnt$ ls
device  optical  recovery  upnp
linuxmce@dcerouter:/mnt$ sudo mkdir manual
linuxmce@dcerouter:/mnt$ cd manual
linuxmce@dcerouter:/mnt/manual$ sudo mkdir nexo-rare

And add a link in from /home/public/data/other, which is much simpler than trying to create the “Pluto structure” and check

Quote
linuxmce@dcerouter:/mnt/manual$ ln -sn /mnt/manual/nexo-rare /home/public/data/other/nexo-rare
linuxmce@dcerouter:/mnt/manual$ ls -lash /home/public/data/other

   0 lrwxrwxrwx  1 linuxmce     linuxmce   21 2009-02-22 10:34 nexo-rare -> /mnt/manual/nexo-rare

linuxmce@dcerouter:/mnt/device$ sudo mount -a -t nfs 192.168.80.228:/pool3/rare /mnt/manual/nexo-rare

Then mount the share and check – victory!

Quote
linuxmce@dcerouter:/mnt/manual$ sudo mount -a -t nfs 192.168.80.228:/pool3/rare /mnt/manual/nexo-rare
[sudo] password for linuxmce:
linuxmce@dcerouter:/mnt/manual$ ls -lash /mnt/manual/nexo-rare/                 total 15K
2.0K drwxrwsr-x 6 root public    8 2009-02-22 00:00 .
4.0K drwxr-xr-x 3 root root   4.0K 2009-02-22 10:18 ..
2.0K drwxrwsr-x 7 root public    7 2009-02-04 20:59 Non-Public
2.0K drwxrwsr-x 3 root public    4 2009-02-21 00:04 public
 512 -rwxrwsr-x 1 root public    0 2009-02-02 06:45 usbstayon
 512 -rwxrwsr-x 1 root public    0 2009-02-02 06:45 usbstayup
2.0K drwxrwsr-x 3 root public    3 2009-02-01 00:42 user_1
2.0K drwxrwsr-x 3 root public    3 2009-02-02 06:45 user_2
linuxmce@dcerouter:/mnt/manual$
But this link to the entire share puts too much data :/home/public/data/other  so, need to clean it up.  So delete the link
Quote
linuxmce@dcerouter:/home/public/data/other$ rm nexo-rare

And just make a link from the videos
Quote
linuxmce@dcerouter:/home/public/data/other$  ln -sn /mnt/manual/nexo-rare/public/data/videos /home/public/data/videos/nexo-rare

AND it works well – but did not survive reboot, so add to /etc/fstab

Quote
192.168.80.228:/pool3/rare /mnt/manual/nexo-rare nfs rw,rsize=1048576,wsize=1048576,hard,intr,proto=tcp,timeo=600,retrans=3,sec=sys,addr=192.168.80.228 0 0
And reboot then check
Quote
linuxmce@dcerouter:~$mount
192.168.80.228:/pool3/rare on /mnt/manual/nexo-rare type nfs (rw,vers=3,rsize=1048576,wsize=1048576,hard,intr,proto=tcp,timeo=600,retrans=3,sec=sys,addr=192.168.80.228)
So very good.   And the movies all work well ON THE CORE / HYBRID…
The don’t work on the media directors.  And instead they show, file not found.

So I checked by logging into an md and while the link is present, the mount is not!  So tried to add the mount into /etc/exports, but it did not work and I could not figure out the way to get privileges on the md.  If I log in as linuxmce, it shows us as user “sambahelper” and su didn’t work…
I found the pw for sambahelper on the core, but it did not work on the md…
http://wiki.linuxmce.com/index.php/Logging_In#The_sambahelper_account

Bottom line is getting the shares to work with the md's would be involved - and I don't have an account to make it happen.

And I am so much more impressed with all the things that happen automagically in linuxmce.

But again, appreciate any advice on what I may be doing wrong with nfs shares.
Thanks,
joseph


schaferj

  • Veteran
  • ***
  • Posts: 133
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #4 on: February 25, 2009, 03:40:55 am »
Friends,

I started with too much detail.

Can anyone let me know if nfs shares (unlike smb/cifs shares) must be installed manually via the webgui?

thanks,
joseph

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #5 on: February 25, 2009, 04:10:29 am »
can't answer that, perhaps jump onto the irc channel?

royw

  • Guru
  • ****
  • Posts: 261
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #6 on: March 05, 2009, 11:46:06 pm »
One NFS gotcha that I've recently ran across when trying to use a macbook as a nfs client to my gentoo server (which also serves media to my linuxmce system) has to do with secure ports.  My solution was to add an "insecure" option to share in the /etc/exports on the server.  I know this is opposite what you are trying but bring it up that some systems restrict the allowable ports differently.  It's been years since I used solaris and just don't know how it handles ports.

And to answer your question, yes, nfs shares must be manually configured.  Follow the "Manual Creation of Network Shares" section on the "Howto: Using Network Shares" wiki page.

HTH,
Roy

royw

  • Guru
  • ****
  • Posts: 261
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #7 on: March 05, 2009, 11:56:10 pm »
Re-reading the thread, I'm a little confused about when you talk about the automounter unmounting the share.  If you are noticing that /mnt/device/124 is disappearing this is normal behaviour.  The data in the share should still be accessible under /home/public/data/videos/NFS Share [124].  Basically the automounter tries to keep shares unmounted except when they are being accessed.  If the data is not there, then we need to troubleshoot.


schaferj

  • Veteran
  • ***
  • Posts: 133
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #8 on: March 07, 2009, 07:42:09 am »
Roy,
Thank you for the insights.
I'm not sure about /home/public/data/videos/NFS Share [124].  I think that the missing data is what caused me to look in /mnt/device, but I can't say for certain right now and I've reconfigured again.
I suppose it should be obvious aso that nfs mounts must be manually configured... 
I picked up solaris again recently because zfs is great - and I think "decade +" would be a good description of shen I last played with it - maybe about the time SunOS 5 came out.
thanks again,
joseph

schaferj

  • Veteran
  • ***
  • Posts: 133
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #9 on: April 08, 2009, 04:40:07 am »
To set a password for root on MD:
chroot /usr/pluto/diskless/<##>
run passwd.... enter password for root

reference:  http://wiki.linuxmce.org/index.php/LinuxMCE-0810_alpha1#Setup_Diskless_MD


nite_man

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1019
  • Want to work with LinuxMCE
    • View Profile
    • Smart Home Blog
Re: NFS media share mounting experience & issues
« Reply #10 on: April 08, 2009, 01:47:22 pm »
Regarding the autounmounting. That makes me crazy a bit. Because USB HDD or NAS (cifs) disappear time to time. With NAS is more or less ok. But using USB HDD is terrible. The system tries to mount/unmount it every minute. As result there are not files from it in the media browser. So, I decided to mount/unmount USB HDD and NAS manually using fstab and creating the symlinks in the audio, videos and pictures. It works fine now. But can somebody explain me, please, the logic of automounting in LMCE?
Michael Stepanov,
My setup: http://wiki.linuxmce.org/index.php/User:Nite_man#New_setup
Russian LinuxMCE community: http://linuxmce.ru

royw

  • Guru
  • ****
  • Posts: 261
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #11 on: April 08, 2009, 06:45:04 pm »
One of the problems with "hard" mounts is they can lead to hung processes if the device stops responding (manually mount an nfs share then disconnect that box from the net, then try to access the share).  Automounter is the more robust solution.

For more info, http://en.wikipedia.org/wiki/Automounter

HTH,
Roy


tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #12 on: April 08, 2009, 06:59:27 pm »
The code for the automounter is placed in /etc/auto.plutoStorageDevices

It performs a lookup into the database, and determines if the device is local or remote. If remote, it creates an smb mount to the remote (or nfs depending on the template), and puts it in place.

The unmounting happens because of the timeout value in autofs. This was done so that devices could be unplugged at any time without any special intervention. The timeout is very small, so devices mount, and unmount constantly. UpdateMedia needs to be made aware of this.

-Thom

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #13 on: April 08, 2009, 10:55:49 pm »
The code for the automounter is placed in /etc/auto.plutoStorageDevices

It performs a lookup into the database, and determines if the device is local or remote. If remote, it creates an smb mount to the remote (or nfs depending on the template), and puts it in place.

The unmounting happens because of the timeout value in autofs. This was done so that devices could be unplugged at any time without any special intervention. The timeout is very small, so devices mount, and unmount constantly. UpdateMedia needs to be made aware of this.

-Thom


Is this the same part of the logic that Totallymaxed has identified that causes shares to go missing for extended periods of time, that they use a workaround by having a process "cd " into the mounted share to force the mount to stay online?

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: NFS media share mounting experience & issues
« Reply #14 on: April 08, 2009, 11:46:19 pm »
Yes, as I said, UpdateMedia and associated code needs to be reworked to handle this ,because keeping a file open to make sure a share isn't unmounted isn't the right answer.

-Thom