Automount EFS volume using fstab

Submitted by sysop on Tue, 12/03/2024 - 14:45

The fstab file (short for File System Table) is a configuration file in Unix and Linux systems that contains information about disk partitions and other file systems. It defines how these file systems should be automatically mounted or managed during the system's boot process and by the mount command. Steps to Automount EFS Volume using fstab:

  1. Install EFS Utilities - Ensure the amazon-efs-utils package is installed to support the efs filesystem type:

    sudo yum install -y amazon-efs-utils  # For Amazon Linux or RHEL
    sudo apt install -y amazon-efs-utils  # For Ubuntu/Debian
  2. Create the Mount Directory - Choose a directory to serve as the mount point for the EFS volume:
     
    sudo mkdir -p /mnt/efs
  3. Identify the EFS File System ID - Get your EFS ID (e.g., fs-12345678) from the AWS Console or CLI. The EFS DNS name will be fs-12345678.efs.<region>.amazonaws.com.
     
  4. Edit the /etc/fstab File - Open the fstab file for editing:
     
    sudo nano /etc/fstab
  5. Add the following line at the bottom of the file:
     
    fs-12345678.efs.<region>.amazonaws.com:/ /mnt/efs efs _netdev,defaults 0 0
  6. Test the Configuration - After saving the fstab file, execute to mount all filesystems specified in /etc/fstab
     
    sudo mount -a
  7. Verify the Mount - Check if the EFS volume is successfully mounted:
     
    df -h

    You should see your EFS volume listed with its mount point. This setup ensures the EFS volume is mounted automatically during system boot.

Tags