Automount EFS volume using fstab
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:
-
Install EFS Utilities - Ensure the
amazon-efs-utils
package is installed to support theefs
filesystem type:sudo yum install -y amazon-efs-utils # For Amazon Linux or RHEL sudo apt install -y amazon-efs-utils # For Ubuntu/Debian
- Create the Mount Directory - Choose a directory to serve as the mount point for the EFS volume:
sudo mkdir -p /mnt/efs
- 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 befs-12345678.efs.<region>.amazonaws.com
.
- Edit the
/etc/fstab
File - Open thefstab
file for editing:
sudo nano /etc/fstab
- Add the following line at the bottom of the file:
fs-12345678.efs.<region>.amazonaws.com:/ /mnt/efs efs _netdev,defaults 0 0
- Test the Configuration - After saving the
fstab
file, execute to mount all filesystems specified in/etc/fstab
sudo mount -a
- 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.