How to Attach and Mount an EBS volume to EC2 Linux Instance
Follow the steps given below carefully for the setup. Step 1: Head over to EC2 –> Volumes and create a new volume of your preferred size and type. Note : Make sure the EBS volume and the instance are in the same zone. Step 2: Select the created volume, right-click and select the “ attach volume ” option. Step 3: Select the ec2 instance from the instance text box as shown below. Step 4: Now, login to your ec2 instance and list the available disks using the following command. lsblk The above command will list the disk you attached to your instance. Step 5: Check if the volume has any data using the following command. sudo file -s /dev/xvdf If the above command output shows “ /dev/xvdf: data “, it means your volume is empty. Step 6: Format the volume to the ext4 filesystem using the following command. sudo mkfs -t ext4 /dev/xvdf Alternatively, you can also use the xfs format. You have to use either ext4 or xfs. sudo mkfs -t xfs /dev/xvdf Step 7: Create a directory of your