Showing posts with label ebs. Show all posts
Showing posts with label ebs. Show all posts

Friday, 2 October 2020

attach mount point to EBS volume using script

 #!/bin/bash

#attach the EBS drive from the console to /dev/sdf


#list the volumes

lslbk

#check if the volume has any data

sudo file -s /dev/xvdf

#format the volume as ext4

sudo mkfs -t ext4 /dev/xvdf

#create a directory

sudo mkdir /myexternalvolume

#mount our EBS to our directory

sudo mount /dev/xvdf  /myexternalvolume



output for the above script:






# with the above process the mount point will save temporarily, To save new mount point changes permanently. edit fstab file.

sudo nano /etc/fstab

 manually activity:

/dev/xvdf    /myexternalvolume  ext4 defaults,nofail    0   0 



press ESC 
:wq!


cat /etc/fstab --> check our new entry.



Attach new EBS volume to EC2 instance

This post will help you to attach a newly crated EBS to volume to particular EC2 instance.

Note: EBS volumes can attach to EC2 only, if both EC2 and newly created EBS volumes are in same Availability  Zone(AZ).


Here are the practical steps:

From the EC2 console page --> Navigate to Elastic Block Storage --> volumes.

select the newly created EBS volume --> Right click on it --> choose with Attach volume option(as shown below).


Provide instance id (which will obtain in EC2 launch page, instance id id EC2 instance specific).
Device : /dev/sdf or /dev/sdp, based on previously available volume.                                            
Click on Attach.                                                                                                                               



                                Thats all the volume is attached to EC2 instance now.                           




Creating new EBS volume

 This post will help you to  create new EBS volumes in AWS.


Practical steps:


From the EC2 launch page navigate to volumes.                                                                                                      



Click on create volumes



Provide details:

1.from the volume type dropdown, select the required volume type.
2.provide size of the volume in GB
 
    based on the size the volume, the iops value will changes.
    suppose for 2GB - min/max iops is 100/3000
    if size of volume is 200GB, then min/max value will be 600/45000


---------------------------------------------------------------------------------------
if the requirement is to create a EBS volume to attach to one specific EC2 instance.
check the Availability zone information here. from running EC2 instance page.









-----------------------------------------------------------------------------------------------------
Enable encryption if really required.
tags are optional.
click on Create volume 


Volume created successfully.                                                                                                                                          
                                                                                                                   



EBS volume intro

 EBS Volume: it's a network drive(i.e not a physical drive)

  • It uses the network to communicate the instance, which means there might be a bit of latency.
  • it can be detached from an EC2 instance and attached to another one quickly.
it's locked to an Availability Zone(AZ)

  • An EBS volume in US-east-1 a cannot be attached to US- east 1b
  • To move a volume across, you first need to snapshot it.


Friday, 24 July 2020

Deleting EBS volume manually.

  1. login to AWS console.
  2. Navigate to Services --> compute --> EC2 --> Volumes.
  3. Select the unwanted volumes, From the Actions drop down --> Delete Volume.

--------------------------------------------------------------------------------------------------------------------------
Note: 

By default, if any EC2 instance is terminated only root volumes are deleted for that particular EC2 instance. it depends on the settings made at the time of EC2 instance launch.

To delete the unwanted volumes need to follow above procedure.


Wednesday, 22 July 2020

how to take snapshot for the EBS Volumes


Intro:







  • Practical steps:
  1. Login to AWS console.
  2. Navigate to Services --> Compute --> EC2 --> Running instances--> select the EC2 instance.
  3. Navigate to Volumes.

4. Select the check box for the volume and Navigate to Actions menu --> Create snapshot. For which snapshot is required. here i am considering root volumes.



5. Then the below screen will appears,Provide description & click on Crete snapshot.                                                                          

6.Conformation screen.Click on close.                                                                                                      
                                                                                         

7. Then from Volumes page. Navigate to snapshots screen.                                                                          



8. Snapshot created,can check the complete status here.                                                                               






Tuesday, 21 July 2020

How to change the EBS disk type

This post will answer the below question:

1.How to change the EBS disk type.


Practical steps:


Step1: 
          login aws console.

Step 2:
            Navigate to services -->compute -->EC2-->Running EC2 instance -->select the correct EC2 instance.  where the modification of EC2 instance is required.

Step 3:

 Under Elastic Block Store  --> click on volumes.
     Here in the availability zone column, each EBS disk can be found here.
              in the Volume Type column -->EBS type info is available.
To change the EBS drive type of one particular EBS drive to another type -->select the correct EBS drive -->Actions dropdown --> Modify volume(as highlighted below).


Note:
Here in the snapshot column, the snapshot value of represents the root drive.


Step4:                                                                                                                                                              
                                                                                                                                                   
Result for the Step 3 will be as below screen. Here in Volume type drop down select the target type of EBS drive. 
in this scenario, im changing from General purpose SSD(gc2)  type to provisioned iops SSD(io1). 


Step 5:                                                                                                                                                            
                                                                                                                                                           
Selected Provisioned IOPS SSD(io1) as my target type. Along with Volume type, we can change SIZE and IOPS range also in the same screen.




Step 6:                                                                                                                                                     

if any action required at OS level. the list of steps for the activity is available in the links highlighted below. Here the links are available for both Windows and Linux based systems.

Click on Yes. To proceed to next step.


Step 7:                                                                                                                                                      
Conform screen. Just click on Close here.                                                                      

---------------------------------------------------------------------------------------------------------------------------


Before performing the above activity, the Volume type is gc2.

Now it is io1. Hurrah!!! we have succeeded in change the EBS type.                                                         



How to extend the EBS volume size of EC2 instance.

This post will answer the below question:

1.How to extended the EBS volume size of EC2 instance.

Thumb rule:
  • Whatever the availability zone the EC2 instance is running, in the same region the EBS volumes are available. the reason behind this rule is hard disk also should be near to mother board.
  •  if in case the EC2 instance and EBS volume are in 2 different availability zones then manually need to make that available in single availability zone.
Advantage with EBS:
  • can increase the EBS volume size and type on fly. No need to stop or shutdown the system.
Practical steps:

1. login aws console.
2.Navigate to services -->compute -->EC2-->Running EC2 instance -->select the correct EC2 instance.  where the modification of EC2 instance is required.
3. Under Elastic Block Store  --> click on volumes.
     Here in the availability zone column, each EBS disk can be found here.
              in the Volume Type column -->EBS type info is available.

   To extended the size of one particular EBS drive -->select the correct EBS drive -->Actions dropdown --> Modify volume.


4. Here in the below highlighted field the default size of EBS drive is 500GiB and can change the size here. just by enter the required size here in the highlighted field.

5.with in short time the additional storage will add in to the EC2 instance. & To adopt this additional storage few steps need to perform at OS level. This detail steps will be available in the below highlighted links(window or Linux) and finally click on YES to conform adding additional storage.


6.Then the below conform & succeeded screen will appears as shown below.                                           


7. if you click on refresh button as shown below the additional storage will update (services -->compute-->EC2 --> Running instance -->select the correct EC2 instance )

Now in the 3rd EBS disk size increase to 1000GB,can observe in the screenshot below