How to configure a NFS mounting in fstab?
How to configure a NFS mounting in fstab?
https://askubuntu.com/questions/890981/how-to-configure-a-nfs-mounting-in-fstab
Asked 8 years, 9 months ago Modified 5 years, 4 months ago Viewed 239k times 27
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?
fstabautomountnfs Share Improve this question Follow edited Apr 24, 2017 at 20:07 David Foerster’s user avatar David Foerster 37k5656 gold badges9898 silver badges155155 bronze badges asked Mar 8, 2017 at 17:57 Nicholas Parmentier’s user avatar Nicholas Parmentier 37111 gold badge33 silver badges33 bronze badges Consider also doing it with systemd: cloudnull.io/2017/05/nfs-mount-via-systemd – Philippe Gachoud CommentedAug 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. – EvilSupahFly CommentedApr 18, 2024 at 2:40 Add a comment 2 Answers Sorted by:
Highest score (default) 47
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 Share Improve this answer Follow edited Apr 24, 2017 at 20:08 David Foerster’s user avatar David Foerster 37k5656 gold badges9898 silver badges155155 bronze badges answered Mar 8, 2017 at 18:08 Thomas’s user avatar Thomas 6,4711313 gold badges3434 silver badges3838 bronze badges Add a comment 4
Edit /etc/fstab and append to the end:
192.168.0.216:/mnt/HDD1 /media/freenas/ nfs rw,bg,soft,intr,nosuid 0 0 Share Improve this answer Follow edited Jul 24, 2020 at 1:01 zx485’s user avatar zx485 2,9251818 gold badges3131 silver badges4040 bronze badges answered Jul 23, 2020 at 16:44 Heron’s user avatar Heron 4111 bronze badge 1 …..soft and intr configure the same behaviour 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 CommentedMay 7, 2021 at 0:43