When you click on links to various merchants on this site and make a purchase, this can result in this site earning a commission. Affiliate programs and affiliations include, but are not limited to, the eBay Partner Network. As an Amazon Associate I earn from qualifying purchases. #ad #promotions



Let’s connect some NFS mounts from a truenas share to a group of local folders like /mnt/dataAA – AE to be automatically mounted at system boot.
Mounting Remote NFS Shares with a systemd service in Ubuntu 22.04
Create directories for your mounts.
Install the nfs client and create a directory for your scripts.
Then copy and paste in the below script. This assumes your machine IP is 192.168.1.XX so please update that to your NFS servers IP address.
Next we will allow the script to be executed.
Then we will go ahead and mount the shares to validate they are mounted.
Now list the directories, you should see your 5 shares mounted now and their sizes reported.
Now unmount the shares now that you have validated your script works as intended since we will be creating a systemd service for this to automatically trigger at boot.
Next create a systemd service to run the script to mount nfs shares.
Then paste in the following
CNTRL + X and Y to save and exit.
Finally you can reboot to test it fires.