Create and mount an EBS volume to your AMAZON instance

In this series so far I explained to set up basic PHP application and use of RDS for relational databases.

For the same couple of times we faced the issue that somehow the instance health check url returned false and as a result our instance got terminated, so we need to again re upload the entire data associate elastic ip etc that is somewhat hectic process

So we googled for the solution and came to know that if instance got restarted the local file system will be lost and you cant retain the data, the solution is to use the persistent storage so even in case of failure the data should remain.

Couple of options are available, some suggested to use bucket and some advised to use the EBS volumes.

I followed the EBS volumes

An informative guide can be found HERE 

Actually its pretty straight forward if you have some advanced linux knowledge for filesystems.

First i created the empty EBS volume, make sure for the availability zone as one volume may not available to other zones.

Ater that you need to associate the volume to your instance use between the range sdc to sdp as sda and sdb are already in use

After assigning to specific instance you can ssh to your instance and see its attached.

Before mounting for first time you need to format the ebs volume by following command

sudo mkfs.xfs /dev/sdc

Where “sdc” is the point of attachment at the time of attaching to instance

After create an empty directory to mount volume with  mkdir command

And final step is to actually mount it

mount /dev/xvdp /wb1

wb1 is the directory created to mount the drive