Additional mounting considerations - Amazon Elastic File System

Additional mounting considerations

We recommend the following values for mount options on Linux:

  • rsize=1048576 – Sets the maximum number of bytes of data that the NFS client can receive for each network READ request. This value applies when reading data from a file on an EFS file system. We recommend that you use the largest size possible (up to 1048576) to avoid diminished performance.

  • wsize=1048576 – Sets the maximum number of bytes of data that the NFS client can send for each network WRITE request. This value applies when writing data to a file on an EFS file system. We recommend that you use the largest size possible (up to 1048576) to avoid diminished performance.

  • 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.

  • timeo=600 – Sets the timeout value that the NFS client uses to wait for a response before it retries an NFS 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.

  • retrans=2 – Sets to 2 the number of times the NFS client retries a request before it attempts further recovery action.

  • noresvport – Tells the NFS client to use a new non-privileged 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.

  • _netdev – When present in /etc/fstab, prevents the client from attempting to mount the EFS file system until the network has been enabled.

In general, avoid setting any other mount options that are different from the defaults, which can cause reduced performance and other issues. If you don't use the preceding defaults, be aware of the following:

  • Changing read or write buffer sizes or disabling attribute caching can result in reduced performance.

  • Amazon EFS ignores source ports. If you change Amazon EFS source ports, it doesn't have any effect.

  • Amazon EFS doesn't support any of the Kerberos security variants. For example, the following mount command fails.

    $ mount -t nfs4 -o krb5p <DNS_NAME>:/ /efs/
  • We recommend that you mount your file system using its DNS name. Amazon EFS resolves this name to the IP address of the Amazon EFS mount target in the same Availability Zone as your Amazon EC2 instance without calling external resources. If you use a mount target in an Availability Zone different from that of your Amazon EC2 instance, you incur standard EC2 charges for data sent across Availability Zones. You also might see increased latencies for file system operations.

  • For more mount options, and detailed explanations of the defaults, see the man fstab and man nfs pages in the Linux documentation.

Note

If your EC2 instance needs to start regardless of the status of your mounted EFS file system, add the nofail option to your file system's entry in your /etc/fstab file.

Unmounting file systems

Before you delete a file system, we recommend that you unmount it from every Amazon EC2 instance that it's connected to. You can unmount a file system on your Amazon EC2 instance by running the umount command on the instance itself. You can't unmount an Amazon EFS file system through the AWS CLI, the AWS Management Console, or through any of the AWS SDKs. To unmount an Amazon EFS file system connected to an Amazon EC2 instance running Linux, use the umount command as follows:

umount /mnt/efs

We recommend that you do not specify any other umount options. Avoid setting any other umount options that are different from the defaults.

You can verify that your Amazon EFS file system has been unmounted by running the df command. This command displays the disk usage statistics for the file systems currently mounted on your Linux-based Amazon EC2 instance. If the Amazon EFS file system that you want to unmount isn’t listed in the df command output, this means that the file system is unmounted.

Example – Identify the mount status of an Amazon EFS file system and unmount it
$ df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda1 ext4 8123812 1138920 6884644 15% / availability-zone.file-system-id.efs.aws-region.amazonaws.com :/ nfs4 9007199254740992 0 9007199254740992 0% /mnt/efs
$ umount /mnt/efs
$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda1 ext4 8123812 1138920 6884644 15% /