AWS Guides: How to increase your EC2 Linux root volume size

awsThis guide applies to increasing the root volume size of an EBS EC2 Linux instance on AWS. By default most Linux instances come with an 8gb root volume unless you changed it at first launch. If you are one of the people that forgot to do this or you just simply need to extend the volume take a look at this guide. Be sure to also check out my other guide on how to increase the size of a Windows EBS Volume.

I started out with an Amazon Linux instance and an 8gb volume. First you want to navigate to your AWS Console and then click EC2 and then Volumes on the left panel. Find the volume that your instance is attached to and right click and create snapshot.


A new window will pop up and you can fill in a name and description and then select ‘Yes, Create’.


Once your snapshot is started creating, navigate over to the snapshot section of the EC2 Console on the left side panel. You will then look for the snapshot you just created with the same name you gave it. This may take a while to for the snapshot process to complete.



Once the snapshot is complete, right click on the snapshot and select ‘Create Volume’. Now pay attention here because this is where you specify the new volume size which is larger than previously, for this example I chose 100gb. Please also note that you need to make the volume in the same Availability Zone as your instance, mine happens to be in us-west-2a. You must also choose either a standard volume or Provisioned IOPS. Once done, press ‘Yes, Create’.


Once the volume is created, navigate over to your EC2 Instances section and go ahead and stop your instance. Once stopped, go ahead and detach the original root volume from the Volumes section of the EC2 Console. To do this you simply find the volume attached to your instance and right click, and select detach.


Once the volume is detached, go ahead and attach the volume you created to the instance by selecting the 100gb volume, right click, and attach the volume to your instance specifying the mount point as /dev/sda1.


You may now start your instance again. Once your instance is back and running go ahead and SSH into the instance (Note: Your IP address may have changed or you may need to re-associate your elastic IP address). You may also need to switch to root if logged in as ec2-user, use ‘sudo -s’ to accomplish this. Now the attached volume will still appear as 8gb until you extend the volume with ‘resize2fs /dev/xvda1’ as seen in the code below. Your mount points may vary, you can check these with either ‘mount’ or ‘fdisk -l’.

[root@ip-10-254-59-62 ec2-user]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            7.9G  957M  6.9G  12% /
tmpfs                 829M     0  829M   0% /dev/shm
[root@ip-10-254-59-62 ec2-user]# resize2fs /dev/xvda1
resize2fs 1.42.3 (14-May-2012)
Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 7
The filesystem on /dev/xvda1 is now 26214400 blocks long.

[root@ip-10-254-59-62 ec2-user]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1             99G  969M   98G   1% /
tmpfs                 829M     0  829M   0% /dev/shm
[root@ip-10-254-59-62 ec2-user]#

If you have made it this far, congrats on your expanded volume. Let me know if you have any questions.

  • Pingback: AWS Guides: How to resize a EC2 Windows EBS Volume | TekGoblin()

  • Muhammad Usama Masood

    Thank you so much.

  • aniruddg

    The filesystem is already nnnnnnn blocks long. Nothing to do! error

    this error occure

  • Ankur Gupta

    Hi this new 30 gb partition are we charged for it ? If yes is there any way to use already allocated 60 gb to avoid any additional charge

  • Lukman Abdul Faqih

    thx u

  • miracleboy31

    when i ran “resize2fs /dev/xvda1”
    i keep getting the following error:

    “resize2fs 1.42.13 (17-May-2015)
    The filesystem is already 2619427 (4k) blocks long. Nothing to do!”

    any thoughts

    • CK Reddy Bhimavarapu

      just check my comment you need to do repartition the disk

  • Steven Munro

    I’m getting The filesystem is already 2095139 (4k) blocks long. Nothing to do!
    What to do now?

  • I’m getting the:

    “The filesystem is already 2095139 (4k) blocks long. Nothing to do!”

    I’ve resized from 8G to 16G. lsblk tells me /dev/xvda is 16G and /dev/xvda1 is 8G.

    • CK Reddy Bhimavarapu

      fdisk /dev/xvda
      d -> delete the partition (don’t worry nothing will be erased, I hope you have only xvda1)
      n -> create new partition (now you can say the end block keep the default ones)
      w -> save the partition
      restart your system ( if this is root volume)

      now do resize2fs


      • Raghav Maheshwari

        after doing fdsik and rebooting, ssh connection timed out and Instance Status Checks also fails

  • Don

    You left out the step of expanding the partition. Use parted’s resizepart command to accomplish that. Then you can do resize2fs to expand the filesystem.

    • It was there in the text 😉

  • BharathKumar S

    please let us know any procedure without downtime/restart/stop

  • Avinash Pawar

    Very nice tutorial.. to the point. I am working on an EC2 instance and in every 3 months my server runs out of memory. I have bookmarked this page. It helps me everytime.
    Thanks a lot.