Before going ahead with this, you have to be connected to your EC2 via SSH, you can check from thislinkhow to connect. Also need to create an EBS volume andattach it to the EC2 instance.

How to Mount EBS on EC2

Step 1: Let’s check if the attached volume on ec2 by this


It will return like this output

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 8G 0 disk -xvda1 202:1 0 8G 0 part / xvdf 202:80 0 10G 0 disk

Step 2:so now need to check the volume if there has any data.sudo file -s /dev/xvdf

If the output looks like this “/dev/xvdf: data“, its meaning your volume is empty.

Step 3: Now we need to format it with ex4sudo mkfs -t ext4 /dev/xvdfStep 4:Create a directory where you want to mount and the mount command

    sudo mkdir/yournewvolume

    sudo mount /dev/xvdf /yournewvolume/`

Step 5:change the directory to yournewvolume by

    cd yournewvolume

    df -h .

by entering df -h . will show you the volume space on that directory.

If once the ec2 instance stop/restart it will unmount again, so if need auto-mount when the ec2 restart, follow this command below.

Auto Mount EBS on EC2

Step 1:For security, please Back up the /etc/fstab file.

sudo cp /etc/fstab/etc/fstab.bak

Step 2:open with nano or vim to this now

  sudo nano /etc/fstab

Now add this line at the end.

/dev/xvdf    /yournewvolume  ext4  defaults,nofail    0    0

Step 3:Run this command below to check any errors found to not. if there is no error, that means its finally done.

sudomount -a

Now you can reboot the instance and check.

How many EBS can attach to EC2?

The answer is 20. This the max number you are able to add.

If you face any issues or anything wrong please feel free to comment.

Banner image credit goes toMarkus Spiske