Home » Cloud » How to expand the EC2 intance root partition in AWS step by step

How to expand the EC2 intance root partition in AWS step by step

Expansion of the C drive/root partition  is very simple and straight forward – however you will need to power off your instance per best practices so data does not change – however there are multiple ways to do this –  this one involves just working the volume in question

First you will need to document the following

  1. Instance ID i-4cf5e4d5
  2. Availability Zone  us-east-1a

you will need these value later for the expansion of the partition

2016-11-13-00_05_55-ec2-management-console

 

Now you can click on the Root Device /dev/sda1 and you will get the following screen – make a note of 1 and 2

  1.  /dev/sda1 defines a boot volume
  2. vol-716c16ed is the volume id

 

2016-11-13-00_08_26-ec2-management-console

Once you click on the vol-716c16ed – it will take you to the screen below –

  1.  one shows the Volume ID
  2. shows the size of the C drive/partition which in this case is 30 GB

 

2016-11-13-00_09_39-ec2-management-console

 

Now you will need to create a snapshot out of the existing volume

  1. Click on Create Snapshot

2016-11-13-01_02_00-ec2-management-console

Clicking it will take you the next screen

  1. Snapshot ID
  2. Name of the Snapshot
  3. Description

2016-11-13-01_06_20-ec2-management-console

Click on Create to start the process – it can take up to hours – all depends on the size of the drive

2016-11-13-01_07_53-ec2-management-console

Go to snapshots Tab on the left side to see if the snapshot has been completed successfully and now you will need to create a new volume from the Snapshot with the expanded size that you want -click on Create Volume and add the details

2016-11-13-01_17_04-ec2-management-console

When creating the new volume – you will need to know the following

  1.  New Size of the drive which in this case we want to increase by 5 GB so the new size is 35 GB
  2. Availability Zone ID that you previously noted which i sus-east-1a in this case

 

2016-11-13-01_18_20-ec2-management-console

Click on the Create radio button to create the volume

2016-11-13-01_19_15-ec2-management-console

 

Now you will need to go the volumes on the left side and search for the olad volume by putting the volume in the search

  1.  Paste the old volume ID in the search box
  2. Once the search is complete and verify the volume ID
  3. Verfiy the old EC2 drive size

2016-11-13-13_43_40-ec2-management-console

You will now need to deatch the volume

2016-11-13-13_52_37-ec2-management-console

Click on detach volume and it will detach from the existing  Ec2 instance

2016-11-13-13_54_08-ec2-management-console

 

Now find the new volume by volume ID that you made a mote of and paste the new volume ID in the search box for volumes – you can see the new volume is now 35 GB

2016-11-13-13_58_11-ec2-management-console

Click on Actions and attach volume

2016-11-13-14_00_20-ec2-management-console

Now you will need to know the Intance ID of the EC intanace and click on Actions and attach Volume

  1. Make sure the Volume ID is correct
  2. Make sure the Intance ID isc orrect
  3. since this is the root volume – you will need to enter /dev/sda1 – otherwise it will not boot

2016-11-13-14_04_27-ec2-management-console

No go to the EC2 dashboard and verify that you can start the instance to make sure the Instance starts

Dont foget the expand the drive in the OS whether is is linux or windows – this just does it on the EC2 backend

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*