

# Enabling automatic mounting on EC2 Linux or Mac instances using NFS
<a name="nfs-automount-efs"></a>

Using NFS without the EFS mount helper to update the Amazon EC2 `/etc/fstab` file, for EC2 Linux and Mac instances.

**To update the `/etc/fstab` file on your EC2 instance**

1. Connect to your EC2 instance. For more information, see [Connect to your EC2 instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect.html) in the *Amazon EC2 User Guide*.

1. Open the `/etc/fstab` file in an editor.

1. To automatically mount a file system using NFS instead of the EFS mount helper, add the following line to the `/etc/fstab` file.
   + Replace {{file\_system\_id}} with the ID of the file system you are mounting.
   + Replace {{aws-region}} with the AWS Region that the file system in, such as `us-east-1`.
   + Replace {{mount\_point}} with the file system's mount point.

   ```
   {{file_system_id}}.efs.{{aws-region}}.amazonaws.com:/ {{mount_point}} nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,_netdev 0 0
   ```

The line of code you added to the `/etc/fstab` file does the following.


| Field | Description | 
| --- | --- | 
| `{{file-system-id}}:/` | The ID for your EFS file system. You can get this ID from the console or programmatically from the CLI or an AWS SDK. | 
| `{{efs-mount-point}}` | The mount point for the EFS file system on your EC2 instance. | 
| `nfs4` | Specifies the file system type. | 
| `mount options` | The comma-separated list of mount options for the file system:+  `nfsvers=4.1` – specifies using NFS v4.1. <br />+  `rsize=1048576` – For improved performance, sets the maximum number of bytes of data that the NFS client can receive for each network READ request when reading data from a file on an EFS file system. `1048576` is the largest size possible. <br />+  `wsize=1048576` – For improved performance, sets the maximum number of bytes of data that the NFS client can send for each network WRITE request when writing data to a file on an EFS file system. `1048576` is the largest size possible. <br />+  `hard` – Sets the recovery behavior of the NFS client after an NFS request times out, so that NFS requests are retried indefinitely until the server replies. We recommend that you use the hard mount option (`hard`) to ensure data integrity. If you use a `soft` mount, set the `timeo` parameter to at least `150` deciseconds (15 seconds). Doing so helps minimize the risk of data corruption that is inherent with soft mounts. <br />+  `timeo=600` – Sets the timeout value that the NFS client uses to wait for a response before it retries a request to 600 deciseconds (60 seconds). If you must change the timeout parameter (`timeo`), we recommend that you use a value of at least `150`, which is equivalent to 15 seconds. Doing so helps avoid diminished performance. <br />+  `retrans=2` – Sets to 2 the number of times the NFS client retries a request before it attempts further recovery action. <br />+  `noresvport` – Tells the NFS client to use a new Transmission Control Protocol (TCP) source port when a network connection is reestablished. Doing this helps make sure that the EFS file system has uninterrupted availability after a network recovery event. <br />+  `_netdev` – Prevents the client from attempting to mount the EFS file system until the network has been enabled.  | 
| `0` | Specifies the `dump` value; `0` tells the `dump` utility to not back up the file system. | 
| `0` | Tells the `fsck` utility to not run at start-up. | 