Lab Exercise 2: Attaching AWS EBS VOLUME TO AMAZON EC2

 Hi all today I am share my experience on how to attach a EBS volume to an EC2 machine following are the pre-requisites required to attach an EBS volume

  • An EC2 Linux instance

Steps followed are as follows

  1. At first to attach an EBS volume we have to create one so to create a volume head over to ec2 service from navigation pane
  2. Next choose volumes and on choose create volume

    3. Create a volume as per your needs and also ensure that the created volume is in the same region as that of ec2 instance created

    4. Now again from volumes tab right click on the newly created volume and attach it to the ec2 instance that have been previously created



5. Now head over to Putty (I am using windows) and connect to ec2 instance remotely(In case of any doubts ref to my previous blog)

6. After that type the following commands as given below to mount the attached volume with the instance

7. First list the available disks using the following command

lsblk

8. 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.

9. Format the volume to the ext4 filesystem using the following command.

sudo mkfs -t ext4 /dev/xvdf


10. 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

11. Mount the volume to “newvolume” directory using the following command.

sudo mount /dev/xvdf /newvolume/

12. 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.


To unmount the volume, use the unmount command as shown below..

umount /dev/xvdf


















Comments

Popular posts from this blog

EX — 6 Hosting a static website on Amazon S3 ​

Cloud Computing and it’s future.