LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Auto Mount not working (AutoFS) (https://www.linuxquestions.org/questions/linux-software-2/auto-mount-not-working-autofs-4175655657/)

louisb 06-13-2019 03:17 PM

Auto Mount not working (AutoFS)
 
I'm trying to auto mount an NFS share when the mount point on the workstation is accessed.

I've made the following entries in the "/etc/auto.master" file:

NAS-Disk /etc/auto.nfs --timeout=60

Followed by the following entries in the "/etc/autofs.nfs" file:

NAS-Disk -fstype=nfs4,rw,soft,intr cscd-nas-1:/volume1/Louis-Disk

I've checked and confirmed that the auto-mount services is running using the following command: "service autofs status". Active (running) was reported in green. The mount point on the local machine is "NAS-Disk". So when ever I reference mount point the NFS volume should get mounted is that correct?

Thanks

michaelk 06-13-2019 03:54 PM

The mount point auto.master should be the base directory and use an absolute path i.e /mnt

autofs will create the subdirectory i.e /mnt/NAS-Disk for my example when the service starts and mount the nfs share when the directory is accessed. Make sure you can mount the nfs share manually.

The ArchWiki on autofs is a good reference.
https://wiki.archlinux.org/index.php/Autofs

jmgibson1981 06-13-2019 09:04 PM

Code:

+auto.master

/megalith /etc/auto.megalith --timeout=30

Code:

pool -fstype=nfs,rw,soft,intr,rsize=8192,wsize=8192 megalith.mylan.home:/snapraid/pool
This is my configuration working flawlessly right now on Ubuntu 18.04. I can't recall where I found these settings, probably the Arch wiki. Should give a structure for you to work from. This gives my automount directory @ /megalith/pool.

louisb 06-22-2019 01:55 PM

I'm just not getting it, so what can I be doing wrong. The log show the following:

Jun 22 14:44:18 Lenovo-T510 automount: st_expire: state 1 path /home/louis/NAS-Disk
Jun 22 14:44:18 Lenovo-T510 automount: expire_proc: exp_proc = 140590999385856 path /home/louis/NAS-Disk
Jun 22 14:44:18 Lenovo-T510 automount: expire_cleanup: got thid 140590999385856 path /home/louis/NAS-Disk stat 1
Jun 22 14:44:18 Lenovo-T510 automount: expire_cleanup: sigchld: exp 140590999385856 finished, switching from 2 to 1
Jun 22 14:44:18 Lenovo-T510 automount: st_ready: st_ready(): state = 2 path /home/louis/NAS-Disk

Above it appears that the mount is executing however, I can't see the file from the NFS Share. But then it also appears that the mount is expiring shortly after the mount takes place. My "/etc/auto.master" and /etc/autoLouis.nfs files are as follows:

/etc/auto.master

/home/louis/NAS-Disk /etc/autoLouis.nfs --timeout=300


/etc/autoLouis.nfs

NAS-Disk -fstype=nfs4 cscd-nas-1:/volume1/Louis-Disk

My understanding of how AUTOFS works is the NFS Share should mount when I execute the following command "cd NAS-Disk", at this point the NFS Share should mount showing all the files on the mount point when I execute a "ls -al" command. Instead I'm not seeing and of the files from the Source of the mount.

When I execute the command "sudo mount -t nfs4 cscd-nas-1:/volume1/Louis-Disk NAS-Disk" the mount executes just fine with no problems and I can see on the files.

Thanks

michaelk 06-22-2019 03:20 PM

As posted your base is /home/louis/NAS-Disk. The actual path to the data should be /home/louis/NAS-Disk/NAS-Disk.

Is /home/louis/NAS-Disk empty?

As a test change auto.master to /mnt and restart autofs.

If you cd to /mnt a NAS-Disk directory should be created and if cd to it hopefully you will see your files.

louisb 06-25-2019 04:17 PM

Sorry it took so long to get back with you. Here's what I found very interesting:

1. Your suggestion worked just fine, I was able to see the NAS-Disk directory and its content.

2. I tried your suggestion on my home directory and I did not get the same results. I follow the template that you provide in your test/exmaple and I experienced the following. When I made and entry in the "auto.master" file pointing it to my home directory and executed the command "cd NAS-Disk" the mount took place however, it wiped out my home directory completely. This forced me to execute a complete reinstall of the OS to put things at a stable level.

3. I went back to your test/example with the same changes and again it worked just fine. Which leaves me to believe that the "automount/autofs" only works with the "/mnt" directory. So the solution for me was to leave things as the test/example and just add a link in my home directory the points to "/mnt/NAS-Disk". This worked perfectly and gave me everything that I was looking for.

During my research and reading I did not recall picking up on anything that suggested or said the "automount/autofs" only works when the mount request is to the directory "/mnt" I guess I missed it.

Please provide me with any feedback that you may have.

Thanks

michaelk 06-25-2019 04:23 PM

I didn't not expect that and sorry for the inconvenience... I've only used /mnt as a base directory.

louisb 06-25-2019 04:59 PM

No problem, thanks so much for you help. You got me on the right track that provide me the solution.

Thanks


All times are GMT -5. The time now is 05:49 AM.