Create an EBS volume for the existing EC2 machine in the same region

 

Create an EBS volume for the existing EC2 machine in the same region

 Create an EBS volume for the existing EC2 machine in the same region

 Step 1: Head over to EC2 –> Volumes and create a new volume of your preferred size and type.

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

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 choice to mount our new ext4 volume. I am using the name “newvolume“. You can name it something meaningful to you.

sudo mkdir /newvolume

Step 8: Mount the volume to “newvolume” directory using the following command.

sudo mount /dev/xvdf /newvolume/

Step 9: cd into newvolume directory and check the disk space to validate the volume mount.

cd /newvolume
df -h .

The above command should show the free space in the newvolume directory.














Comments

Popular posts from this blog

The Future of Cloud computing