I have a system running RHEL 5.5, and I am trying to mount a Windows share on a server using autofs
. (Due to the network not being ready upon startup, I do not want to utilize fstab
.) I am able to mount the shares manually, but autofs
is just not mounting them.
Here are the files I am working with:
At the end of /etc/auto.master
, I have:
## Mount this test share:
/test /etc/auto.test --timeout=60
In /etc/auto.test
, I have:
test -fstype=cifs,username=testuser,domain=domain.com,password=password ://server/test
I then restart the autofs
service.
However, this does not work. ls
-ing the directory does not return any results. I have followed all these guides on the web, and I either don't understand them, or they.just.don't.work.
Thank You
Since I just spent my entire morning debugging this same issue. Let me explain what happened above.
/etc/auto.master
This means I want to mount something at
/test
and for the details read/etc/auto.test
/etc/auto.test
This means as a sub-folder of what was specified in auto.master please mount test with the information following. (i.e. the mount will be
/test/test
as slm correctly pointed out).This means that
ls /test/test
will display the contents of//server/test
To accomplish the original goal of /test -> //server/test you would want the following:
/etc/auto.master
A couple other notes. I found the following mount options useful.
rw
- mount it read/writenoserverino
- removes error message about inode number supportcredentials=[credential file]
- this allows you to create a separate file with the credentials in them. It has the following format:EDIT -- 2013-06-17 13:28PM GMT-8
slm in the comments has pointed out that mounting to the root of the file system could be dangerous. lsd in the comments suggests a workaround, which is to creating a symlink from the root of the filesystem to a different place where you would mount that would not overlap with something common. For example, if you wanted to have /test be a mount, then you would actually mount stuff to /net/the_test_mount and then create a symlink /test that points to /net/the_test_mount
There should be an /etc/auto.smb already, use that, and add the following line to /etc/auto.master:
Now all cifs shares will show up under /cifs:
will show all the shares available. You might want to put some options in /etc/auto.smb to mount with specific modes. I have a auto.smb that I found out there somewhere and modified to do exactly that:
This will do what you want. I've used it myself.
I just did this on a CentOS 5.6 box and I think part of your problem might be with your auto.test file. In it's current form you'll be creating a /test mount point and then a single moung of test under it, i.e. /test/test. Also you might want to add the --ghost switch to your auto.master line like so:
The --ghost switch creates stubs of mount points even when a given share isn't being actively mounted.
Take a look at this CentOS wiki Tips and Tricks page on ways to mount SMB/CIFS shares.
Mounting tips
idea #1
idea #2
If you are using cifs it's recommended also to use
_netdev
parameter._netdev
it's because the filesystem resides on a device that requires network access, this is used to prevent the system from attempting to mount these filesystems until the network has been enabled on the host system.