In this short tutorial, we will show you how to mount an NFS share on Linux. This is often necessary when you don’t want to store directories, such as mail accounts or websites, on the root partition of your Linux system, but rather in a shared folder for backups, additional storage, or similar purposes. The process of mounting is super easy and can be done with just a few commands.

To use NFS on our Linux system, we first need to install NFS-Common. You can do this by entering the following command in your terminal:

apt-get install nfs-common

Next, we will create a mount point at a location of our choice. The /mnt folder is already present in the system and is typically used for additional mounted media. Therefore, we will create the storagespace folder as a subdirectory under /mnt:

mkdir /mnt/storagespace

Now, we will mount the NFS share into the folder /mnt/storagespace using the following command:

mount -t nfs DATA_HOST:/DATA_PATH /mnt/storagespace

And that’s it! The NFS share is now mounted.

However, this mount is only temporary. This means that if we reboot our system, the NFS share will no longer be mounted. If we want the volume to be mounted automatically after a reboot, we need to edit the fstab file.

Permanently Mounting NFS Shares via Fstab

By editing the fstab file, you can ensure that NFS shares are mounted automatically after a reboot. This is a great option because we don’t want to have to remount all drives manually after each restart.

So, let’s edit the fstab file using your preferred text editor:

nano /etc/fstab

Then we enter the following at the end of the file:

Server:/Pfad/zum/NFS-Share /mnt/storagespace nfs defaults 0 0

If everything went well when saving and closing the file, the NFS share should now be persistent.

And that’s it for our short tutorial on “Mounting an NFS Share on Linux”. If you encounter any problems, feel free to leave us a comment. We will gladly help you.

Unmounting a Volume

If you want to temporarily unmount a mounted volume, you can do so with the following command:

umount /mnt/storagespace

Now, the folder will still exist, but the NFS share will no longer be mounted in that folder.

Conclusion

Mounting an NFS share on a Linux system is a straightforward process that provides flexibility for managing storage across networked systems. By following a few simple steps, you can easily install the necessary NFS utilities, create a mount point, and mount your NFS share. For permanent mounting, editing the fstab file ensures that the NFS share remains mounted even after a reboot, making it a convenient solution for long-term storage needs. Additionally, the ability to unmount the share when required adds further control over your storage setup. With these steps, managing NFS shares becomes efficient and seamless, allowing you to optimize your system’s resources with minimal effort.

Leave a Reply

Your email address will not be published. Required fields are marked *