25

I have a NFS share folder on a FreeNas system. I'm able to mount this share and use it with this command:

mount -t nfs -o proto=tcp,port=2049 192.168.0.216:/mnt/HDD1
/media/freenas/

I just don't know how to do that in /etc/fstab so it does it automatically. How can I do that?

2
  • Consider also doing it with systemd: cloudnull.io/2017/05/nfs-mount-via-systemd Commented Aug 13, 2018 at 16:35
  • I understand that I'm a bit late to this party, but using the systemd way is ten lines of code in that one example, plus two terminal commands versus one line of code for fstab. I don't know about you, but personally, I feel like brevity is the soul of wit, and even with manually making the mount destination directory, fstab feels like the faster, cleaner option. Commented Apr 18 at 2:40

2 Answers 2

43

A typical /etc/fstab entry for a NFS mount looks like as follows:

192.168.0.216:/mnt/HDD1    /media/freenas/    nfs    defaults    0 0 

The options you supply looks pretty much default, but you can add those as well:

192.168.0.216:/mnt/HDD1    /media/freenas/    nfs    defaults,proto=tcp,port=2049    0 0 
0
1

Edit /etc/fstab and append to the end:

192.168.0.216:/mnt/HDD1 /media/freenas/ nfs rw,bg,soft,intr,nosuid 0 0
1
  • 1
    .....soft and intr configure the same behavior and should not be used together. Also, soft can lead to data corruption and should not be used unless you understand the nuances deeply.
    – Ajax
    Commented May 7, 2021 at 0:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .