we create the following mount point and nfsshare folder as share folder on all our linux client machines ( total 1872 machines - redhat 7.2 )

master1:/nfs             41932800 6563840  35368960  16% /nfsshare

I just thinking about if from some reason by mistake someone of our users decided by mistake to perform umount to /nfsshare

in that case it will cause real problem to the application

so is it possible mount automatically if from some reason mount folder isn't mounted ?

  • 3
    Possible duplicate of How to prevent fs unmounting? – αғsнιη May 8 at 6:17
  • I dont understand the resoling on this post - how to prevent umount! – yael May 8 at 6:22
  • which part you didn't understand? please edit your question and tell us – αғsнιη May 8 at 6:24
  • please explain - what need to set in order to mount auto after folder is unmounted? – yael May 8 at 6:29
  • 1
    Unless your users have root privileges, they should not be able to unmount a NFS filesystem mounted as root - unless you've specifically permitted that. – telcoM May 9 at 12:05

As you're using RHEL 7.x, you could use a systemd .automount unit. Just make an entry like this in /etc/fstab:

master1:/nfs /nfsshare nfs defaults,noauto,x-systemd.automount 0 0
  • mount option noauto disables classic-style mounting at boot time
  • mount option x-systemd.automount causes systemd-fstab-generator to create an .automount unit in addition to a regular .mount unit. (Note: parallelizable .mount units are the way systemd handles filesystem mounts specified in /etc/fstab, instead of a traditional single-threaded mount -a.)

Make sure the mount-point directory /nfsshare exists; in theory systemd should automatically create it if it does not exist, but right now there is a bug affecting the auto-creation of mount points.

This will auto-mount the specified filesystem on demand: whenever an user process touches /nfsshare, the NFS filesystem will be automatically and transparently mounted if it isn't already mounted.


This could be performed by a script or command line launched by a crontab. The command would be like :

mount | grep /nfsshare || [your mount command]

details :

  • mount | grep /nfsshare : search your mount point in the list of active mounts
  • the double pipe || is a Bash construct for "do this if the preceding command returns a non-success"
  • ... then actually mount your NFS share

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.