Creating an EBS volume and mounting to EC2
And yet again, I am back with a post on Amazon Web Services after so long time. Its just because I was quite busy with my freelancing projects and got no time to write blogs. Anyways, today I am going to help you create an EBS Volume and mount it to EC2.
First of lets create an EBS Volume:
1. Login to AWS Console
2. Once logged in to go EC2 Dashboard
3. From EC2 Dashboard Go to Elastic Block Store [EBS ]-> Volumes from sidebar menu
4. Create a new volume in the region of your EC2 intance so that it becomes available for use by your EC2 instance.
->Volume Type: Standard Volume
-> Size: 25 GB or your requirement
-> Availability zone: should be of your EC2 instance's zone
-> Snapshot : No snapshot
Once the volume is created, you can attach the drive to the EC2 instance by Right clicking and clicking on attach.
Now lets mount the volume to EC2.
1. SSH login to your EC2 instance
2. ls /dev/ -> should list your new volume which would be something like xvdj, xvkk, xvdm, svdn, .. lets take it to be xvds for our case.
3. Format the volume to Ext4 using the command:
#mkfs.ext4 /dev/xvds
4. Create a point where we will mount the volume for our case it will be /newvolume/
#mkdir -m 000 /newvolume/
5. Now mount the drive to the mount point
#mount /dev/xvds /newvolume/
6. To make it automount in reboot, run the following command:
echo "/dev/xvds /newvolume auto noatime 0 0" | sudo tee -a /etc/fstab
Now, your new EBS Volume is accessible at /newvolume/ . Hope this helps you mount your EBS volume to your Amazon EC2 instance.
Comments
Post a Comment