I am running OpenSuSE 13.2 and need to disable auto mount for my NFS volume because I don’t always have my NFS server always running and when I don’t have it running it takes 3 and a half minuets longer to boot because Linux is trying to mount the volume.
How are you mounting? Is there an entry in “/etc/fstab” for that volume?
“automount” is a confusing term here, because there is something called the automounter. And maybe that’s what you should be using. It is done with the “autofs” service. Using the automounter, the volume is not mounted unless accessed. The automount tries to mount it when you first try to access it. It seems that would work, as long as you don’t try to access that volume when you know that the server is not available.
Further to nrickert’s comments, there’s some good information in the following reference concerning mounting remote file systems using either /etc/fstab or autofs:
Apart from the fact that, as already explained, automount is a rather sloppy expression with at least three (3) different meanings in Linux alone, I think I understand what you mean
I have the same situiation here. A NFS server that migh t be running or not when the client boots. I solved it this way.
In the /etc/fstab entry, I added the option noauto to avoid the system trying to mount at boot:
boven.henm.xs4all.nl:/home/wij /home/wij nfs noauto 0 0
A crontab run by root. It checks if the mount is active. When not it checks if the NFS server is running. When yes, it mounts.
The first check (if mounted already or not) is done by creating a file in the mount point directory when the file system is unmounted. This file disappears fom “view” when the file system is mounted and reappears when the file system is unmounted. I choose a telling name for that file.
beneden:~ # crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.u9mgrc installed on Tue Jul 15 12:31:29 2014)
# (Cronie version 4.2)
-*/1 * * * * /root/bin/nfsmount
beneden:~ # cat bin/nfsmount
#!/bin/bash
if -a /home/wij/Niet-gemount ]]
then ping -c 1 -q boven >/dev/null && mount /home/wij >/dev/null 2>&1
fi
beneden:~ #
On 2015-06-03 09:46, hcvv wrote:
> A crontab run by root. It checks if the mount is active. When not it
> checks if the NFS server is running. When yes, it mounts.
Good idea.
> The first check (if mounted already or not) is done by creating a file
> in the mount point directory when the file system is unmounted. This
> file disappearses fom “view” when the file system is mounted and
> reappears when the file system is unmounted. I choose a telling name for
> that file.
Ha. I do the same (not_mounted). However, I think it is more reliable
(the file might be deleted) to grep the output of “mount” command for
the presence of the mount point. If the string is there, it is mounted.
–
Cheers / Saludos,
Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)
Each to his own. I would not know how that file could be deleted. It is of course owned by root, like the mountpoint.
We did this very often in our professional environment. Not only we, but even the most dumb of our users would understand what is going on when the mountpoint only contained the file “The-file-system-is-not-mounted”.
But again, there are as usual a lot of solutions. No need to post all of them IMHO. Leave some of the thinking to the audience.
On 2015-06-03 13:56, hcvv wrote:
>
> robin_listas;2713424 Wrote:
>>
>> Ha. I do the same (not_mounted). However, I think it is more reliable
>> (the file might be deleted) to grep the output of “mount” command for
>> the presence of the mount point. If the string is there, it is mounted.
>>
> Each to his own. I would not know how that file could be deleted. It is
> of course owned by root, like the mountpoint.
Fat fingers of Mr Root, LOL
As I said, I use both solutions.
–
Cheers / Saludos,
Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)