I want to mount an Amazon FSx for NetApp ONTAP storage virtual machine (SVM) volume on my Amazon Elastic Compute Cloud (Amazon EC2) Linux instance. I want to use Network File System (NFS).
Resolution
Note: The following steps are for EC2 instances that run on Amazon Linux 2023 (AL2023).
Prerequisites:
- NFS v3 only: Your instance must allow outbound traffic on TCP/UDP ports 2049, 111, 635, 4045, 4046, and 4049.
- NFS v3 only: The NetApp ONTAP file system must allow inbound traffic on ports 2049, 111, 635, 4045, 4046, and 4049.
- NFS v4 only: Your instance must allow outbound traffic on TCP port 2049.
- NFS v4 only: The NetApp ONTAP file system must allow inbound traffic on TCP port 2049.
Use NFS to mount your SVM volume on your EC2 Linux instance
Complete the following steps:
-
To install the required packages, run the following command:
sudo yum install -y nfs-utils
-
To create a directory on the instance to mount the SVM volume, run the following command:
sudo mkdir /mnt/fsx-nfs
-
To mount the file system, run the following command based on your NFS version.
NFS v3:
sudo mount -t nfs -o vers=3 svm-XZY.fs-ABCDE.fsx.region.amazonaws.com:/fsx /mnt/fsx-nfs
Note: Replace svm-XZY.fs-ABCDE.fsx.region.amazonaws.com with the DNS name of your SVM and /fsx with the junction path of the volume.
NFS v4:
sudo mount -t nfs -o vers=4.1 svm-XZY.fs-ABCDE.fsx.region.amazonaws.com:/fsx /mnt/fsx-nfs
Note: Replace svm-XZY.fs-ABCDE.fsx.region.amazonaws.com with the DNS name of your SVM and /fsx with the junction path of the volume.
-
(Optional) To set up automatic mount during the boot process, add the following line to the /etc/fstab file.
NFS v3:
svm-XZY.fs-ABCDE.fsx.region.amazonaws.com:/fsx /mnt/fsx-nfs nfs defaults,_netdev,hard,noresvport,x-systemd.automount,x-systemd.requires=network-online.target,vers=3 0 0
Note: Replace svm-XZY.fs-ABCDE.fsx.region.amazonaws.com with the DNS name of your SVM and /fsx with the junction path of the volume.
NFS v4:
svm-XZY.fs-ABCDE.fsx.region.amazonaws.com:/fsx /mnt/fsx-nfs nfs defaults,_netdev,hard,noresvport,x-systemd.automount,x-systemd.requires=network-online.target,vers=4.1 0 0
Note: Replace svm-XZY.fs-ABCDE.fsx.region.amazonaws.com with the DNS name of your SVM, /fsx with the junction path of the volume, and 4.1 with your NFS version number.
Troubleshoot NFS mount issues
Important: It's a best practice to create a NetApp account. You must have a NetApp account to access NetApp knowledge base articles.
To troubleshoot NFS mount issues, see Why can't I mount my FSx for ONTAP file system on my EC2 Linux instance?
Check the FSx for ONTAP server configuration
To verify that the NFS service is running and you're using the required version, run the following command:
vserver nfs status
vserver nfs show
To check whether your security style affects your permissions, run the following command to identify your security style:
volume show -volume volume_name -fields security-style
Note: Replace volume_name with the file system's volume name. For more information about security styles and their effects, see Learn about ONTAP NAS security styles on the NetApp website.
To verify that your configuration allows the client IP address, run the following command:
vserver export-policy rule show -policyname policy_name -instance
Note: Replace policy_name with the FSX for ONTAP server policy for the NFS server.