- Create new extra EBS volume from AWS console named
/dev/xvdf
- Attach the new volume to EC2 from AWS Console
- Connect to EC2, create a new directory and mount the new extra EBS volume
-
Check all devices attached
sudo lsblk -f
-
Determine if file system exist for the new volume
sudo file -s /dev/xvdf
-
Create a new file system on EC2 to mount volume
mkfs -t xfs /dev/xvdf
-
Create new mount point directory to mount the new volume on EC2
sudo mkdir /data
-
Mount the volume to this new directory
sudo mount /dev/xvdf /data
-
Grant full access permission
sudo chmod -R 777 /data
-
Confirm its mounted
sudo lsblk -f
When you check df -h
you won't see the new volume xvdf
as a mounted to EC2 local directory. You have to manually connect to E2 and create file system, mount directory and mount EBS volume.
df -h
# Lists all the block devices in the Linux Machine:
lsblk
# Check if there is any file system on new EBS Volume:
file -s /dev/xvdf
(If you see "Data", meaning you need to setup file system for this block device.)
# Create a file system on volume to mount it to EC2:
mkfs -t xfs /dev/xvdf
# Create new directory:
mkdir -p /apps/my-data/apps/volume/new-volume
cd /apps/my-data/
# Mount volume to EC2 Instance:
mount /dev/xvdf /apps/my-data/apps/volume/new-volume
https://www.youtube.com/watch?v=XqOoNMLlKus&t=432s https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html