How to mount EBS & EFS(disk) volumes

June Chung
2 min readSep 15, 2020

--

SUMMARIZED VERSION

Check the available volumes
>> lsblk

Check if there is a file system attached — or else you will need to (since only filesystem can be mounted)
>> file -s /dev/xvdf

If there is no file system create file system
>>sudo mkfs -t xfs /dev/xvdf

Now mount the new volume to the local /opt/jira_home directory
>> mount /dev/xvdf /opt/jira_home

NOW MAKE THE VOLUME MOUNTED EVERY TIME WHEN REBOOT (PERMANENT)

This file determines the mounting per reboot : /etc/fstab

Copy the file just in case you mess up
>>sudo cp /etc/fstab /etc/fstab.orig

Find the UID of your newly attached volume
>> sudo blkid
Then copy the UID in a nodepad

VI into the fstab file
>> vi /etc/fstab

And add this line with the actual UID in and save
>> UUID=aebf131c-6957–451e-8d34-ec978d9581ae /opt/jira_home xfs defaults,nofail 0 2

Now test if it is mounted correctly
>> umount /opt/jira_home

>> mount -a

>> lsblk
and then check the mount point if it shows /opt/jira_home

EFS MOUNTING

How to mount an EFS volume — very easy
https://docs.aws.amazon.com/efs/latest/ug/wt1-test.html

Many ways to mount 1. EFS client 2. NFS client 3. via IP
1, 2 is using DNS endpoint of EFS, 3 is using IP of EFS

sudo mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport mount-target-DNS:/ <which local path you want to mount>

MAKE SURE YOU CHANGE PERMISSIONS IN LOCAL PATH
chmod 777 (default will be only owner can write and use)

How to unmount
sudo umount <local path that was mounted>

--

--