blog/content/general/create-nfs-share.md
Mathieu Broillet 8e9efebeb1
All checks were successful
continuous-integration/drone/push Build is passing
remove draft status
2023-06-11 16:09:58 +02:00

1.6 KiB

title date draft author description tags
How to create and connect to an NFS Share 2023-06-11T15:33:44+02:00 false Mathieu Broillet Just a few commands to keep on hand
emojis
fedora

To create an NFS share, you'll first need to install the nfs-kernel-server package. You can do this by running the following command:

{{< code language="BASH" expand="Show" collapse="Hide" isCollapsed="false" >}} sudo apt install -y nfs-kernel-server {{< /code >}}

Once the installation is complete, navigate to the /etc/exports file and add the following configuration (this is just an example):

{{< code language="BASH" expand="Show" collapse="Hide" isCollapsed="false" >}} /data/library 192.168.0.0/16(rw,sync,no_subtree_check) {{< /code >}}

To mount the NFS share on a client machine, you'll need the nfs-common package. Install it by running:

{{< code language="BASH" expand="Show" collapse="Hide" isCollapsed="false" >}} sudo apt install -y nfs-common {{< /code >}}

Next, open the /etc/fstab file and add the following entry:

{{< code language="BASH" expand="Show" collapse="Hide" isCollapsed="false" >}} 192.168.1.207:/data/library /data/library/ nfs defaults,user,auto,nofail,_netdev,bg 0 0 {{< /code >}}

If you prefer to mount the share without using /etc/fstab, you can run the following command:

{{< code language="BASH" expand="Show" collapse="Hide" isCollapsed="false" >}} sudo mount -t nfs 192.168.1.207:/data/library /mnt/temp {{< /code >}}

That's it! You should now have your NFS share set up and ready to use. Let me know if you need further assistance.