Oracle Linux - How to Mount a NFS Share using systemd
Applies to:
Linux OS – Version Oracle Linux 7.0 to Oracle Linux 9.0 [Release OL7 to OL9]
Linux x86_64 on Oracle Public Cloud
Goal:
How to Mount a NFS share using systemd to provide more flexible configuration.
It enables you to stage dependencies when mounting if needed.
Solution:
This howto assumes that a NFS Server is already configured and any firewall rules to allow connections between Server and Client are in place.
1) Create a unit file for the NFS mount:
[root ~] # cat > /etc/systemd/system/myNFS.mount << EOF [Unit] Description=My NFS Share After=network.target [Mount] What=10.0.0.****:/nfs-share Where=/myNFS Type=nfs Options=vers=4.2,rsize=1048576,wsize=1048576,proto=tcp,timeo=600,retrans=3 [Install] WantedBy=multi-user.target EOF
Tagged:
1