TECHIES WORLD

For Techs.... Techniques.... Technologies....

AWSBashLinux

How to attach additional EBS volume to EC2 instance

Amazon Elastic Block Store (Amazon EBS) provides persistent block storage volumes for use with Amazon EC2 instances in the AWS Cloud.

This tutorial explains the detailed steps to attach additional EBS volume to EC2 instance.

Step1: Login to aws console

Step2: Create new volume as per the required size and type.

Step3: Select the newly created volume and select the "attach volume" option.

Step4: Login to the ec2 instance and list the available disks.

#lsblk

For explaining the later steps, we are using the name '/dev/nvme2n1' for the new disk.

Step5: Check if the volume has any data using the following command.

#file -s /dev/nvme2n1

If the above command output shows “/dev/nvme2n1: data”, it means your volume is empty.

Step6: Format the volume to ext4 filesystem.

#mkfs -t ext4 /dev/nvme2n1

Step7: Create the mount point directory.

#mkdir /disk1

Step8: Mount the new volume

#mount /dev/nvme2n1 /disk1

Please note that this mount is temporary and will get unmounted during instance reboot. If it required to enable automount during reboot you we need to follow the steps in the below link.

That's all….

Leave a Reply