Setting Up An NFS Server And Client On OpenSUSE 12.2

Version 1.0
Author: Falko Timme
Follow me on Twitter
Last edited 10/15/2012

This guide explains how to set up an NFS server and an NFS client on OpenSUSE 12.2. NFS stands for Network File System; through NFS, a client can access (read, write) a remote share on an NFS server as if it was on the local hard disk.

I do not issue any guarantee that this will work for you!


1 Preliminary Note

I'm using two OpenSUSE systems here:

  • NFS Server:, IP address:
  • NFS Client:, IP address:


2 Installing NFS


On the NFS server we run:

zypper install nfs-kernel-server

Then we create the system startup links for the NFS server and start it:

systemctl enable rpcbind.service
systemctl start rpcbind.service
systemctl enable nfsserver.service
systemctl start nfsserver.service


On the client we can install NFS as follows:

zypper install nfs-client


3 Exporting Directories On The Server


I'd like to make the directories /home and /var/nfs accessible to the client; therefore we must "export" them on the server.

When a client accesses an NFS share, this normally happens as the user nobody. Usually the /home directory isn't owned by nobody (and I don't recommend to change its ownership to nobody!), and because we want to read and write on /home, we tell NFS that accesses should be made as root (if our /home share was read-only, this wouldn't be necessary). The /var/nfs directory doesn't exist, so we can create it and change its ownership to nobody and nogroup:

mkdir /var/nfs
chown nobody:nogroup /var/nfs

Now we must modify /etc/exports where we "export" our NFS shares. We specify /home and /var/nfs as NFS shares and tell NFS to make accesses to /home as root (to learn more about /etc/exports, its format and available options, take a look at

man 5 exports


vi /etc/exports

# See the exports(5) manpage for a description of the syntax of this file.
# This file contains a list of all directories that are to be exported to
# other computers via NFS (Network File System).
# This file used by rpc.nfsd and rpc.mountd. See their manpages for details
# on how make changes in this file effective.

/home ,sync,no_root_squash,no_subtree_check)

(The no_root_squash option makes that /home will be accessed as root.)

Whenever we modify /etc/exports, we must run

exportfs -a

afterwards to make the changes effective.


4 Mounting The NFS Shares On The Client


First we create the directories where we want to mount the NFS shares, e.g.:

mkdir -p /mnt/nfs/home
mkdir -p /mnt/nfs/var/nfs

Afterwards, we can mount them as follows:

mount /mnt/nfs/home
mount /mnt/nfs/var/nfs

You should now see the two NFS shares in the outputs of

df -h

client:~ # df -h
Filesystem              Size  Used Avail Use% Mounted on
rootfs                   12G  3.4G  7.5G  31% /
devtmpfs                997M  4.0K  997M   1% /dev
tmpfs                  1004M   96K 1004M   1% /dev/shm
tmpfs                  1004M  580K 1003M   1% /run
/dev/sda2                12G  3.4G  7.5G  31% /
tmpfs                  1004M     0 1004M   0% /sys/fs/cgroup
tmpfs                  1004M  580K 1003M   1% /var/lock
tmpfs                  1004M  580K 1003M   1% /var/run
tmpfs                  1004M     0 1004M   0% /media
/dev/sda3                17G  387M   16G   3% /home     12G  1.5G  9.6G  13% /mnt/nfs/home   12G  1.5G  9.6G  13% /mnt/nfs/var/nfs
client:~ #



client:~ # mount
devtmpfs on /dev type devtmpfs (rw,relatime,size=1020060k,nr_inodes=255015,mode=755)
tmpfs on /dev/shm type tmpfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
/dev/sda2 on / type ext4 (rw,relatime,data=ordered)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=24,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
tmpfs on /var/lock type tmpfs (rw,nosuid,nodev,relatime,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,relatime)
tmpfs on /var/run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
/dev/sda3 on /home type ext4 (rw,relatime,data=ordered)
none on /proc/fs/vmblock/mountPoint type vmblock (rw,relatime)
gvfs-fuse-daemon on /run/user/falko/gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,relatime,user_id=1000,group_id=100) on /mnt/nfs/home type nfs4 (rw,relatime,vers=4.0,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=,local_lock=none,addr= on /mnt/nfs/var/nfs type nfs4 (rw,relatime,vers=4.0,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=,local_lock=none,addr=
client:~ #


5 Testing

On the client, you can now try to create test files on the NFS shares:


touch /mnt/nfs/home/test.txt
touch /mnt/nfs/var/nfs/test.txt

Now go to the server and check if you can see both test files:


ls -l /home/

server:~ # ls -l /home/
total 4
drwxr-xr-x 6 administrator users 4096 Jul 19 17:26 administrator
-rw-r--r-- 1 root          root     0 Sep 14 20:47 test.txt
server:~ #

ls -l /var/nfs

server:~ # ls -l /var/nfs
total 0
-rw-r--r-- 1 nobody nogroup 0 Sep 14 20:47 test.txt
server:~ #

(Please note the different ownerships of the test files: the /home NFS share gets accessed as root, therefore /home/test.txt is owned by root; the /var/nfs share gets accessed as nobody, therefore /var/nfs/test.txt is owned by nobody.)


6 Mounting NFS Shares At Boot Time

Instead of mounting the NFS shares manually on the client, you could modify /etc/fstab so that the NFS shares get mounted automatically when the client boots.


Open /etc/fstab and append the following lines:

vi /etc/fstab

[...]  /mnt/nfs/home   nfs      rw,sync,hard,intr  0     0  /mnt/nfs/var/nfs   nfs      rw,sync,hard,intr  0     0

Instead of rw,sync,hard,intr you can use different mount options. To learn more about available options, take a look at

man nfs

To test if your modified /etc/fstab is working, reboot the client:


After the reboot, you should find the two NFS shares in the outputs of

df -h




7 Links

Share this page:

0 Comment(s)

Add comment