How to Resize Root Partition on Linux in Amazon EC2

Channel: Linux
Abstract: One of my EC2 Linux instance is getting out of disk. Initiallywill help you to resize root partition of ec2 Linux instance. Backups Instance It is str

One of my EC2 Linux instance is getting out of disk. Initially, we forgot to add higher disk size and it was launched with default 8GB disk. Now, our system required more disk space to run properly.

This tutorial, will help you to resize root partition of ec2 Linux instance.

Backups Instance

It is strongly recommended to create full backup (AMI) of your instance before resizing root volume. This will be helpful for recover from any unexpected issues.

Now, follow one of the below methods to resize root disk on your EC2 Linux system.

Method 1 – Using Disk Snapshot
  1. Stop your instance
  2. Go to volumes and create a snapshot from volume. You can find volume details from your instance description.
  3. Go to snapshots and wait for the snapshot completed. After that:
    • Create a new volume from the newly created snapshot.
    • Set the new size in Size (GiB) column.
    • Set the proper availability zone. It must be the same as your instance is running in.
    • Now click on 「Create Volume」.
  4. Attach new volume as root to your instance
  5. Start your instance
Method 2 – Using Instance AMI

In this method, current a new instance will be launched. In that case, the instance ID will be changed.

  1. Stop your instance
  2. Create an AMI of your instance
  3. Go to AMIs pages. Once the AMI is created, launch a new instance from AMI
  4. In the wizard, you must set new disk size in Add Store step.
  5. Complete the wizard to launch your instance
  6. Once instance launch complete, you may need to swap elastic IP from old instance
Verify Upgraded Disk

At this point your root volume has been resized successfully. Just verify your disk has been resizes properly

df -h 

Ref From: tecadmin

Related articles