Solved

automount in Linux

Posted on 2011-03-09
32
615 Views
Last Modified: 2012-05-11
I am trying to understand about automounting in Fedora. I have a server where the users home folders get automounted.

there are 2 Fibre Channel arrays that are mounted to the server. the entries are listed in fstab.

I looked in /etc/auto.master and there are 2 lines not commented out

/misc   /etc/auto.misc
/net    -hosts


I have been looking around, but jsut getting confused.
0
Comment
Question by:ryan80
  • 18
  • 14
32 Comments
 
LVL 12

Author Comment

by:ryan80
ID: 35086252
I guess I should add that the reason that I started looking into this is that I have a stale NFS file handle.

when I do an ls in one of the automounted home folders i get a message of:

ls: cannot access <filename>: Stale NFS file handle
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35086532
As per my understanding you have user's home directories on your server and you want to mount that on user's system or on other servers through automount. Correct me if I am wrong and more elaborate your query.
0
 
LVL 12

Author Comment

by:ryan80
ID: 35086893
That is how it is currently configured (I am coming into a working development system already and learning as I go along)

The users home folders mount correctly already, but in one of them there is a file that has a Stale NFS file handle. I want to get rid of this file and read that by dismounting and remounting the export, it could possibly clear out the problem. that is what I am trying to accomplish.

However I also want to learn more about the automount process so I can make changes if need be in the future.
0
 
LVL 12

Author Comment

by:ryan80
ID: 35088453
ok, as an update, the mountpoints that are controlled from LDAP
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35090881
To get rid on Stale NFS file handle, just unmount that NFS file system and remount that. If you are not sure that which one you need to umount and remount then please give us output of df -Th.

To umount and remount the NFS mount follow the below given commands.

umount /mount/point

Like /mnt is a Stale NFS file system then command world be.

umount /mnt

If it gives error or not unmounting the share then try this.

umount -f /mnt

To remount use following.

mount -t nfs nfsserver:/path/to/share /mount/point
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35091055
To configure automount please do the following steps.

put the following line in the /etc/auto.master

/home /etc/auto.home  --timeout=60

and the following line in /etc/auto.home

*       -fstype=nfs,rw,soft,intr,rsize=8192,wsize=8192,nfsvers=3  <Ip Address of NFS server>:/home/&


Save the file. Restart autofs:

# /etc/init.d/autofs restart

Make sure that autofs is starting on boot (after reboot). If you are using RedHat/Fedora Linux:

# chkconfig autofs on


To dig more in automount.

http://tldp.org/HOWTO/Automount.html

http://freespace.sourceforge.net/guidod/howto/autofs.html
0
 
LVL 12

Author Comment

by:ryan80
ID: 35099868
Ok,

I looked into autofs and LDAP a little more and found an article about configuring it. I saw that there is a file "nsswitch.conf" that has the following line in it.

automount:  files ldap

From what I understand, this says to check both the auto.master file and LDAP for mounts to use for automount?







The location that has the stale mount is:

/Production/home/prod on /home/prod type none

It is automounted from the mount of:

/dev/mapper/mpath0p2 on /Production type ext3

Thing is, this is a fibre channel share. Will the same things apply?

would it be

umount /Production

mount -t ext3 /dev/mapper/mpath0p2 /Production

To unmount it and then mount it? do you think this will correct the issues of the Stale NFS file?
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35106234
unmount and mount command always remain same just we need to change the filesystem type as per our need.

Could please send me output of df -Th from the system where you are getting NFS stale error. Because I am confused with your above message.

The location that has the stale mount is:

/Production/home/prod on /home/prod type none

It is automounted from the mount of:

/dev/mapper/mpath0p2 on /Production type ext3



Output of df -Th will give us clear undestanding about your issue.
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35106375
automount:  files ldap

It has first entry for files which means first it will go and look auto.master and then redirect according the values in auto.master. If It found necessary info and achive its goal then It will not go and check with LDAP.

If It will not found necessary info in auto.master then It will go in LDAP to check the value for automount.

It works in the same sequence in which you write in nsswitch.conf, If you put LDAP first like:

automount:  ldap files

Then It will go to LDAP first.


0
 
LVL 12

Author Comment

by:ryan80
ID: 35108379
here is the df -Th

df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
              ext3    222G   16G  195G   8% /
/dev/sda1     ext3     99M   15M   80M  16% /boot
none         tmpfs    2.9G     0  2.9G   0% /dev/shm


0
 
LVL 12

Expert Comment

by:upanwar
ID: 35108425
I am not able to see any NFS filesystem mounted. Have you fixed your issue?
0
 
LVL 12

Author Comment

by:ryan80
ID: 35108546
Sorry the above post is from the wrong system. Here is the correct information



df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00           ext3     66G   23G   39G  38% /
/dev/sda1                                                    ext3    190M   17M  164M  10% /boot
tmpfs                                                           tmpfs    1.5G   52K  1.5G   1% /dev/shm
/dev/mapper/mpath0p1                               ext3    148G  131G   11G  93% /Development
/dev/mapper/mpath0p2                               ext3    148G   25G  116G  18% /Production
0
 
LVL 12

Author Comment

by:ryan80
ID: 35108575
That is the thing, there are no NFS filesystems

i was looking into it more and I saw people that had the same issues. they were recommending unmounting it, and then running fsck.ext3 -f on the filesystem.

Does that sound correct?
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35108750
This output is also not showing any NFS filesystem. Have you exported NFS filesystem from this box.

Could you please show me showmount -e
0
 
LVL 12

Author Comment

by:ryan80
ID: 35108779
showmount -e
Export list for server:
/Production  10.x.x.0/24
/Development 10.x.x.0/24
0
 
LVL 12

Author Comment

by:ryan80
ID: 35108790
I believe that this server shares out these 2 diretories as NFS exports for other servers.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 12

Expert Comment

by:upanwar
ID: 35108823
So you need to umount and mount again the NFS share on the client machine not on the server. It is the server which have share the NFS share.

If you ned further help, just update us.
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35108892
Yes you understanding is correct.
0
 
LVL 12

Author Comment

by:ryan80
ID: 35109594
there are several clients that have this NFS export mounted from the server. It will need to be unmounted from all of these clients?
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35109638
No, you dont need to  unmount from all client machine. You just need to umount and mount again on the box on which you are getting NFS stale error.

0
 
LVL 12

Author Comment

by:ryan80
ID: 35111037
ok, so unmount and mount the ext3 file system and that should take care of the issue?
0
 
LVL 12

Author Comment

by:ryan80
ID: 35111045
by the way thanks for bearing with my lack of understanding with Linux.
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35114121
No If you will unmount and mount ext3 file system on NFS server then all the client would have error Stale NFS.

You just need to umount and mount the NFS filesystem on the client machine which is giving problem.

If you will run mount command or df -h on the client machine where you have mounted /home/prod

It will show you filysystem type NFS instead on ext3.

so on the server box from where you have exported

Export list for server:
/Production  10.x.x.0/24
/Development 10.x.x.0/24

you no need to do anything.

I guess know it is informative for you

0
 
LVL 12

Author Comment

by:ryan80
ID: 35114621
Only problem is, I am getting this error on the server machine, not the clients.
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35114888
On the server could you please run mount command show me the output, as per our conversation I havent seen any NFS mounted Filesystem on your server.

Just show the output of mount command and do the ls -la in directory tree where you were getting error.
0
 
LVL 12

Author Comment

by:ryan80
ID: 35128660
# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/mapper/mpath0p1 on /Development type ext3 (rw)
/dev/mapper/mpath0p2 on /Production type ext3 (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
/Production/home/prod on /home/prod type none (rw,bind)



#ls -la
ls: cannot access abcd.linux04.4.running: Stale NFS file handle
total 8
drwxr-xr-x  2 prod prod 4096 2011-03-14 07:16 .
drwxr-xr-x 12 prod root 4096 2011-03-01 15:51 ..
-rw-r--r--  1 prod prod    0 2010-09-05 20:40 abcd.linux01.stop
-rw-r--r--  1 prod prod    0 2010-09-15 10:40 abcd.linux02.stop
-rw-r--r--  1 prod prod    0 2010-09-15 10:40 abcd.linux03.stop
-?????????  ? ?        ?       ?                ? abcd.linux04.4.running
-rw-r--r--  1 prod prod    0 2010-10-07 14:56 abcd.linux04.start
-rw-r--r--  1 prod prod    0 2011-02-16 14:56 abcd.linux04.stop
-rw-r--r--  1 prod prod    0 2011-03-14 08:56 abcd.linux05.10.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.11.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.12.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.1.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.2.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.3.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.4.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.5.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.6.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.7.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.8.running
-rw-r--r--  1 prod prod    0 2011-03-14 07:16 abcd.linux05.9.running
-rw-r--r--  1 prod prod    0 2010-10-07 14:56 abcd.linux05.start

0
 
LVL 12

Author Comment

by:ryan80
ID: 35128671
the ls -la is from /home/prod/abcdcontrol
0
 
LVL 12

Expert Comment

by:upanwar
ID: 35130150
Could you please show ls -la of  /Production/home/prod/

# ls -la /Production/home/prod/

and also show me ls -la of /Production/home/prod/abcdcontrol and update me if you are getting the same NFS stale filesystem error.

# ls -la /Production/home/prod/abcdcontrol

Also show me fstab file.

# cat /etc/fstab

Before executing below given step, show me above requested first.

As per my understanding till now, you need to unmount the /home/prod

# umount /home/prod

then need to execute below given command.

# mount -a
0
 
LVL 12

Author Comment

by:ryan80
ID: 35137561
#ls -ls /Production/home/prod
total 1500
   4 drwxr-xr-x  2 prod prod    4096 2009-12-02 15:26 download
   4 drwxr-xr-x  2 prod prod    4096 2010-04-20 09:22 logs            
   4 drwxr-xr-x  2 prod prod    4096 2011-02-09 18:14 profiles
   4 drwxrwxr-x 19 prod prod    4096 2010-09-25 09:13 releases
1320 drwxr-xr-x  2 prod prod 1347584 2011-02-09 11:02 tmp
   4 -rw-r--r--  1 prod prod    1940 2010-11-29 09:14 x.x
  84 -rw-r--r--  1 prod prod   80576 2010-11-29 09:13 x.x~
  44 -rw-r--r--  1 prod prod   43787 2009-12-11 07:13 abcd.cc
   4 drwxr-xr-x  2 prod prod    4096 2011-03-15 07:16 abcdControl

# ls -ls /Production/home/prod/abcdControl
ls: cannot access /Production/home/prod/abcdControl/abcd.linux04.4.running:  Stale NFS file handle
total 0
0 -rw-r--r-- 1 prod prod 0 2010-09-05 20:40 abcd.linux01.stop
0 -rw-r--r-- 1 prod prod 0 2010-09-15 10:40 abcd.linux02.stop
0 -rw-r--r-- 1 prod prod 0 2010-09-15 10:40 abcd.linux03.stop
? -????????? ? ?        ?    ?                ? abcd.linux04.4.running
0 -rw-r--r-- 1 prod prod 0 2010-10-07 14:56 abcd.linux04.start
0 -rw-r--r-- 1 prod prod 0 2011-02-16 14:56 abcd.linux04.stop
0 -rw-r--r-- 1 prod prod 0 2011-03-15 08:41 abcd.linux05.10.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 07:16 abcd.linux05.11.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 08:36 abcd.linux05.12.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 07:16 abcd.linux05.1.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 07:16 abcd.linux05.2.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 07:16 abcd.linux05.3.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 07:16 abcd.linux05.4.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 07:16 abcd.linux05.5.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 07:16 abcd.linux05.6.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 07:16 abcd.linux05.7.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 08:36 abcd.linux05.8.running
0 -rw-r--r-- 1 prod prod 0 2011-03-15 08:36 abcd.linux05.9.running
0 -rw-r--r-- 1 prod prod 0 2010-10-07 14:56 abcd.linux05.start




cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
UUID=xxxxxxxx-ae8f-yyyy-b4a3-zzzzzzzzzzzz /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
#/dev/mapper/3600ayyyyyyxxxxxx00000aczzzzzz006p1 /Development   ext3    defaults        1 1
#/dev/mapper/3600ayyyyyyxxxxxx00000aczzzzzz006p2 /Production    ext3    defaults        1 1
#/dev/mapper/mpath0p1 /Development      ext3    defaults        1 2
#/dev/mapper/mpath0p2 /Production       ext3    defaults        1 2




# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/mapper/mpath0p1 on /Development type ext3 (rw)
/dev/mapper/mpath0p2 on /Production type ext3 (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
/Production/home/prod on /home/prod type none (rw,bind)
0
 
LVL 12

Accepted Solution

by:
upanwar earned 500 total points
ID: 35137620
I have seen and found that /Production is not a NFS file system, its a local one but since you are facing issue with it so could you please umount /Production and then mount it again.
0
 
LVL 12

Author Comment

by:ryan80
ID: 35139515
ok i will give that a shot. It will have to wait until the weekend for a maintenance window.
0
 
LVL 12

Author Closing Comment

by:ryan80
ID: 35227859
Sorry for the long delay, I missed the maintenance window and had to wait until today.

I unmounted a remounted /Production, but it did nothing. I unmounted the drive and put it into single user mode. I then ran fsck.ext3 /dev/mapper/mpath0p2. It found about 5 issues, one of them being a orphaned inode (i think that is what it was) that refered to the file.

After the fsck finished, I mounted the drive and the Stale file handler was gone.

Thanks for all the help. This question went well beyond the original question, and you really helped me with my understanding of mounting file systems.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now