nfs_automount icon indicating copy to clipboard operation
nfs_automount copied to clipboard

Mounting a subfolder from a nfs share fails

Open jerrac opened this issue 11 years ago • 2 comments

In /etc/fstab, if I do something like:

nfshost:/export/data/subfolder    /mounts/data/subfolder/ nfs     nfsvers=3,rw    0 0

It mounts just fine.

If I try with nfs_automount:

MOUNTS=MOUNTS=("rw|nfshost|/export/data/subfolder|/mounts/data/subfolder|")

It throws a [CRIT] Remote share '/export/data/subfolder' unavailable! error because showmount -e nfshost does not output subfolders of nfs shares. The check_remoteshare function returns false.

The only way to make it work I can think of right now (with no testing, and not being very good at bash programming), is to not run the check_remoteshare function.

Anyone else have a better idea?

jerrac avatar Oct 07 '13 23:10 jerrac

FYI, I "fixed" the problem by commenting out lines 311-312 and 330-332 in /usr/local/bin/nfs_automount.

Not a very good fix since it removes the check for the nfs share.

    # Make sure the remote NFS share is available
    #check_remoteshare ${_remotesystem} ${_remoteshare}
    #if ${_RET} ; then

      # Make sure the local mountpoint exists and is free
      valid_for_mount ${_localmountpoint}
      if ${_RET} ; then

        log "[INFO] Attempting mount: ${mountcmd} ${_mountopts} ${_remotesystem}:${_remoteshare} ${_localmountpoint}"
        ${mountcmd} ${_mountopts} ${_remotesystem}:${_remoteshare} ${_localmountpoint}
        if [ $? -ne 0 ] ; then
          log "[CRIT] Unable to mount share '${_remoteshare}'!"
        else
          log "[INFO] Share '${_remoteshare}' mounted from '${_remotesystem}' at '${_localmountpoint}'."
        fi

      else
        log "[CRIT] Local mount point '${_localmountpoint}' missing or already in use!"
      fi

    #else
    #  log "[CRIT] Remote share '${_remoteshare}' unavailable!"
    #fi

jerrac avatar Oct 08 '13 21:10 jerrac

I created a pull request to fix this. It will strip the remoteshare down to the first folder and check for that folder being shared. https://github.com/vwal/nfs_automount/pull/12

proximous avatar Aug 21 '15 02:08 proximous