SUSE Support

Here When You Need Us

How to create an NFS Server and mount a share to another Linux server

This document (7015345) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15
SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server 11

Situation

How to create an NFS Server and mount a share at another Linux server.

Resolution

How to create an NFS Server to export or share a directory:

  1. YaST --> Network Services --> NFS Server, select Start.
  2. Click Next.
  3. Select Add Directory, provide the local directory path to export, and click OK.
  4. A box will come up for configuring the export options for that path.  "Host Wild Card" is used to define what NFS client hosts will be allowed to mount.  This will default to "*" (any client) but can be changed to limited allowed clients, based on hostnames, ip addresses, subnets, netgroups, etc.  See "man exports" for more details.
  5. The export options for the defined client hosts will usually need to be changed, based on administrative preferences and security needs.  Frequently it is desired to replace ro (read-only) with rw (read-write) and replace root_squash with no_root_squash, to allow the client's root user to be treated as a true root user on the NFS share.  Otherwise the client's root user is "squashed" and treated like "nobody".
  6. Click OK and then click Finish.

How to mount an NFS Share at a Linux client host.  Select from the following options:

  • (option 1) To setup permanent mounts within YaST:
    • YaST --> Network Services --> NFS Client --> Add.
    • Provide the NFS Server Hostname or Network Address.
    • For Remote Directory click Select.  Choose a path and click OK.
    • Provide a Mount point (local directory).
    • For Options, the defaults are usually okay, but other mount options can be added there.
    • Click OK and OK.
  • (option 2) To temporarily mount, from a terminal window (one-time mount):
    mount <hostServer>:/share <localMountPoint>

    Note: The local mount point directory must already be created.
  • (option 3) To create a permanent (at boot) mount manually (without yast), edit /etc/fstab and add the following line in:
    <hostServer>:/<share> <localMountPoint>    nfs     defaults 0 0
    Note: Replace <hostServer> with the NFS Server name or IP address, replace <share> with the path which has been exported from the NFS Server, and replace <localMountpoint> with a local path which already exists.  If you wish to change the default mount options, replace the word "defaults" with whatever options are desired.

 

Cause


Additional Information

See Open SuSE documentation for more details.
 
If configuring manually instead of in yast:
 
To set nfsserver to always come up during boot:
systemctl enable nfsserver
 
To set nfs client to always activate during boot:
systemctl enable nfs
NOTE:  NFS mounts in /etc/fstab are typically mounted even if "nfs" hasn't been enabled, but enabling "nfs" will cause a more thorough activation of all nfs client dependencies, in the best order.

To restart NFS Server on SLES 15 or 12:
systemctl restart nfsserver
 
To restart NFS Server on SLES 11:
rcnfsserver restart
 
To restart NFS client on SLES 15 or 12:
systemctl restart nfs

To restart NFS Client on SLES 11:
rcnfs restart

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7015345
  • Creation Date: 09-Jul-2014
  • Modified Date:12-Feb-2025
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.