Quantcast
Channel: Wagiman Wiryosukiro – Blog Emka
Viewing all articles
Browse latest Browse all 4693

Automatically Mount NFS with Systemd

$
0
0

Follow this step:

  1. create network share for NFS
[root@nfs-server ~]# exportfs -v
/data           (sync,wdelay,hide,no_subtree_check,sec=sys,rw,no_root_squash,no_all_squash)

try those NFS mounting, with mount command:

mount 192.168.168.10:/data /share

and check:

df -h /share

if you’re successfully to mount those NFS, then unmount.

umount /share

  1. Create Systemd Unit to mount NFS

with nano/vim, create a new file /etc/systemd/system/mount-nfs

[Unit]
Description=NFS Share from nfs-server.example.com(192.168.43.10)
DefaultDependencies=no
Conflicts=umount.target
After=network-online.target remote-fs.target
Before=umount.target

[Mount]
What=192.168.43.10:/data
Where=/share
Type=nfs
Options=defaults

[Install]
WantedBy=multi-user.target

reload systemd daemon,

systemctl daemon-reload

then start it:

systemctl start mount-nfs

and check the mounting directory.


Viewing all articles
Browse latest Browse all 4693

Trending Articles