LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-28-2014, 06:22 AM   #1
yglin
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Rep: Reputation: Disabled
Why and how settings of mounting NFS in /etc/rc.local are overrided with /etc/fstab?


I have a RHEL5.5 host as NFS Client.
I didn't do the configuration and I don't know why it is that and ...
  1. I found mount command in /etc/rc.local and also mount settings in /etc/fstab
  2. I checked /proc/mounts and discovered that the mount options not follow those in /etc/rc.local
  3. I googled some pages and it seems /etc/rc.local is the last script excuted when system startup

So now I'm not sure when and how were the mount options overrided and I have to find out.

Is /etc/fstab applied after or before /etc/rc.local?
Or there could be some script mounting NFS after /etc/rc.local

Please point me some direction to inspect the reason
THANX~!!
 
Old 04-28-2014, 10:27 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
/etc/fstab is used during system setup - RHEL 5.5 still uses a standard init, so the mounts are done by the contents /etc/rc[2345].d (as appropriate for the run level). NFS mounts are normally done by the S25netfs scripts during boot. local should be processed by S99local.

Since the startup scripts are run in standard sort order (Snn), that makes the NFS mounts (S25*) done before local (S99).

BTW, if network manager is present and being used, all bets are off. It hasn't been called NetworkMangler for nothing. The problem is that the network isn't necessarily ready when NetworkManager finishes... thus NFS mounts have been known to fail the first time. By the time rc.local gets run, it might be ready...

Last edited by jpollard; 04-28-2014 at 10:33 AM.
 
Old 04-28-2014, 10:37 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,957

Rep: Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267Reputation: 1267
The filesystem was probably already mounted by the "netfs" service, which occurs before rc.local is run, and thus the mount in rc.local simply fails. I see several alternatives:
  1. Just put the options you want in /etc/fstab and let the netfs auto-mount do the work,
  2. Remove that entry from /etc/fstab entirely,
  3. Include "noauto" in the options in /etc/fstab so that the auto-mount will skip that entry,
  4. In rc.local, include "remount" in the options so that the mount command will (attempt to) replace the current mount options with the ones you specify.
Option 4 is of course going to fail if, for some reason, the filesystem was not already mounted.

Why do you want to do this in rc.local instead of just setting up /etc/fstab with the correct options and letting netfs take care of the mount?
 
Old 04-28-2014, 10:42 AM   #4
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Do you know what is to be mounted?

If so let us know what is to be mounted.

Please let us know :

1.What is to be mounted?
2.Contents of rc.local
3.Contents of /etc/fstab

Can you manually mount the nfs share?

Last edited by prayag_pjs; 04-28-2014 at 10:45 AM.
 
Old 04-29-2014, 01:10 AM   #5
yglin
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
First thanks for your replys.
There is a trouble that the host in problem is actually one of my customer's production servers,
so I can't get access to it at once.
But I can give you the content of rc.local and /proc/mounts

rc.local
Code:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
mount -t nfs -o rw,bg,soft 10.1.XXX.XXX:/volumes/nrenas_vol1/appnre /var/aptg
bash /home/nre/scripts/roaming/maintain/autostart.NRE_Handlers.sh
/proc/mounts
Code:
rootfs / rootfs rw 0 0
/dev/root / ext3 rw,data=ordered 0 0
/dev /dev tmpfs rw 0 0
/proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
/proc/bus/usb /proc/bus/usb usbfs rw 0 0
devpts /dev/pts devpts rw 0 0
/dev/sda1 /boot ext3 rw,data=ordered 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
/etc/auto.misc /misc autofs rw,fd=7,pgrp=6118,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,fd=13,pgrp=6118,timeout=300,minproto=5,maxproto=5,indirect 0 0
10.1.XXX.XXX:/volumes/nrenas_vol1/appnre /var/aptg nfs rw,vers=3,rsize=1048576,wsize=1048576,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=10.1.213.83 0 0
And about /etc/fstab, I'm very sorry that I found that there is no nfs mounting point in /etc/fstab.
So the actual problem is "NFS mounting options in rc.local are overrided somewhere at sometime"

I did some experiments on my own RHEL 5.5 machine, mount manually in shell and I found that:
If mounted with same options the system says that the mount point is already mount or busy,
BUT when I change some options I can mount with no error message,
and the new duplicated mount point shows up in /proc/mounts.
like this
Code:
10.1.XXX.XXX:/volumes/nrenas_vol1/appnre /var/aptg nfs rw,vers=3,rsize=1048576,wsize=1048576,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=10.1.213.83 0 0
10.1.XXX.XXX:/volumes/nrenas_vol1/appnre /var/aptg nfs rw,vers=3,rsize=1048576,wsize=1048576,soft,proto=tcp,timeo=600,retrans=2,sec=sys,addr=10.1.213.83 0 0
Now I'm really confused because I thought /proc/mounts is the most accurate place to monitor current mounts stat.
How can same mount points co-exists in /proc/mounts? what does that mean? which set of options is applied currently?

Last edited by yglin; 04-29-2014 at 01:21 AM.
 
Old 04-29-2014, 07:21 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Are you confused by the defaults for unspecified parameters?

You show that the filesystem was mount with "rw,bg,soft", and that is exactly what is shown in your list of /proc/mounts.

rw - you wanted read write, you got rw.
bg - is an option to the mount, not the filesystem.
soft - that is an error recovery option for the client (hard is the default).

The only option shown that is different is the hard/soft option. Mounting hard is a reliability issue as it guarantees that a write will complete. Mounting soft allows for interrupting what would normally be an uninterruptable wait, but it also allows for data corruption. Everything else is default values.

As to "mount point busy" depends on matching what you want against what is already done. That is up to the mount command, not the filesystem. It used to be more rigid that one and only one mount can be done on a mount point - but with bind mounts, union mounts, and others, the restriction on mounts has been relaxed. It seems to only report "busy" when the entire option list matches what has already been mounted - thus a mount is redundant. If you want to remount a filesystem, use -o remount. The mount command will then dismount the filesystem and mount it again, using the new parameters. (granted, that might be counted as an error - for fun try mounting a third time with the original parameters and see if it is rejected. If it is accepted, I think that really counts as a bug).

As a side note, I suspect the rsize/wsize parameters are coming from the server (it is a MB size, which is larger than any network parameters for NFS, so I suspect the server is providing the parameters from its own filesystem which may be a raid stripe size). The timeout value is a default, and the retransmit value may be a default (I thought it was 5, but that might be for UDP instead of TCP). The security option is specified by the server.

Last edited by jpollard; 04-29-2014 at 07:33 AM.
 
Old 04-30-2014, 04:50 AM   #7
yglin
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for your advices, jpollard
But sorry if I didn't get any of your points.

I'm confused why a single mount point can be mounted with different options in /proc/mounts.
If, as you said, this is possible with bind mounts or union mounts,
then which set of options applied when accessing NFS(e.g. list a folder on NFS)?

I further tested -o remount but got yet another confusing result.
"mount -o remount ..." several times with different option values
This time no error message at all, infact no output at all
The mount options in /proc/mounts remained the same but I can see my last remount options in /etc/mtab
I am losing my confidence in /proc/mounts ...
Is /proc/mounts really the right place where kernal puts its up-to-date mount info? I just have to sure about it

And about the mount options I gave in previous posts
Those are options on my customer's production server
I too can not understand why they were set that way
Googled for default rsize/wsize, it's about 8K, far more smaller than 1MB, and retrans default 3

As to my very first question,
I guess I'll never find out why the options being overrided after system startup
I've checked dmesg and user history, no suspicious mount executed, don't know where-else can look up for mount logs

Last edited by yglin; 04-30-2014 at 04:51 AM.
 
Old 04-30-2014, 06:40 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
You will have to study more about how NFS works.

A number of options are specified by the server and can limit what the client can do.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NFS entries in /etc/fstab not mounting on boot jwolter0 Linux - Server 11 02-27-2012 02:28 PM
Fedora 15 not mounting NFS shares from fstab PreacherBill Fedora 11 07-05-2011 04:16 PM
NFS mounting using FSTAB Ammad Linux - Networking 7 12-18-2008 07:23 AM
[SOLVED] Mounting NFS File Systems using /etc/fstab vikas027 Linux - Networking 2 09-15-2008 04:13 AM
Mounting NFS filesystem fstab vs autofs rrich100 Linux - Networking 0 11-13-2003 02:38 PM


All times are GMT -5. The time now is 10:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration