Login to your AWS management console,click on EC2 in the list of AWS products and from there, identify the correct region of EC2 instance because EC2 EBS volume must be in the same location as the EC2 instance:
Click Volumes located under Elastic Block Store then click on Create Volume button, which will launch the EBS volume creation wizard, Simply fill in the details and click Yes,Create:
Note: EBS volume that is created in us-east-1a, will only be mounted to a EC2 instance located in us-east-1a.
Right clicking on the EBS volume that we have just created and select Attach Volume from the menu:
Select the Instance that you want to attach with EC2 EBS volume:
Then click the Yes, Attach button to attach the EBS volume:
Next login to the AWS instance where you attached the EBS volume and type:
sudo fdisk -l
Where xvdf is our newly added EBS!
To create the partition on the second EBS, use the following command and follow the “on screen” instructions:
sudo fdisk /dev/xvdf
Use the partprobe command to update the kernel with the changes:
sudo partprobe /dev/xvdf
Note: Where /dev/xvdf is my device name, you can use your’s!
Now we need to format our newly created parition using the following command:
sudo mkfs /dev/xvdf1 -t ext4
Verify the newly created partition:
sudo fdisk -l
Next you need to create a directory for a mount point:
cd /mnt/ sudo mkdir 2ndEBS
Next, mount the newly created xvdf1 parition into 2ndEBS directory:
sudo mount /dev/xvdf1 /mnt/2ndEBS -t ext4
Configure the permission on 2ndEBS directory:
sudo chmod 0777 /mnt/2ndEBS/
Now, we make a test that we can write a file on to the new drive:
touch /mnt/2ndEBS/test.txt ls /mnt/2ndEBS/*
Next time, when we will reboot the computer, it will be gone. If we want to mount new EBS permanently then we need to edit the fstab file:
sudo nano /etc/fstab
Add this line at the end of the fstab file(you can adjust it according to your requirement):
/dev/xvdf1 /mnt/2ndEBS ext4 defaults 0 0
Use this command or else reboot your computer:
sudo mount –a
Hope this will help you!