I have already mounted AWS EFS one folder in EC2 instance. I want to mount another one folder in same AWS EFS. Is this possible?
You can use a Symbolic Link.
mkdir -p /mnt/efs
echo "${FileSystem}.efs.${AWS::Region}.amazonaws.com:/ /mnt/efs nfs4 defaults" >> /etc/fstab
mount -a
ln -s /var/www/html/media /mnt/efs/media
ln -s /var/www/html/var /mnt/efs/var
First your create a root directory for the mount point ( /mnt/efs
). Them you mount the FileSystem in this directory ( /mnt/efs
). Now for example, if you want to map /var/www/html/media
create a symbolic link pointing to the mounted point ( ln -s /var/www/html/media /mnt/efs/media
). This will create a folder in /mnt/efs/media
.
It is possible to mount two different directories under file mount system. Initially in order to access your efs just mount a EFS root under your instance using the command
sudo mount -t efs fs-id:/ /home/efs
Then create subdirectories under the /home/efs
folder for example let's have two subdirectories under /home/efs
namely images and data.
Now you can mount two directories in your which is likely to be under /var/www/html/images
and /var/www/html/data
by adding the below in fstab
file which will be under /etc/
fs-id:/images /var/www/html/images efs defaults,_netdev 0 0
fs-id:/data /var/www/html/data efs defaults,_netdev 0 0
And reboot your instance. Whatever changes in /var/www/html/data
will gets reflected in fs-id:/data
folder also the same applies for image folder also hope this helps. Initially you need to setup efs-utils
in your instance.
I created symbolic link and it reflects in both sym link and main folder but does not reflect in another mounted server
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.