Increasing Root Disk Size of an "EBS Boot" AMI on EC2


This article is about running a new EC2 instance with a larger boot volume than the default. You can also resize a running EC2 instance.

Amazon EC2’s new EBS Boot feature not only provides persistent root disks for instances, but also supports root disks larger than the previous limit of 10GB under S3 based AMIs.

Since EBS boot AMIs are implemented by creating a snapshot, the AMI publisher controls the default size of the root disk through the size of the snapshot. There are a number of factors which go into deciding the default root disk size of an EBS boot AMI and some of them conflict.

On the one hand, you want to give users enough free space to run their applications, but on the other hand, you don’t want to increase the cost of running the instance too much. EBS volumes run $0.10 to $0.11 per GB per month depending on the region, or about $10/month for 100GB and $100/month for 1TB.

I suspect the answer to this problem might be for AMI publishers to provide a reasonable low default, perhaps 10GB as per the old standard or 15GB following in the footsteps of Amazon’s first EBS Boot AMIs. This would add $1.00 to $1.50 per month to running the instance which seems negligible for most purposes. Note: There are also IO charges and charges for EBS snapshots, but those are more affected by usage and less by the size of the original volume.

For applications where the EBS boot AMI’s default size is not sufficient, users can increase the root disk size at run time all the way up to 1 TB. Here’s a quick overview of how to do this.


The following demonstrates how to run Amazon’s getting-started-with-ebs-boot AMI increasing the root disk from the default of 15GB up to 100GB.

Before we start, let’s check to see the default size of the root disk in the target AMI and what the device name is:

$ ec2-describe-images ami-b232d0db
IMAGE   ami-b232d0db    amazon/getting-started-with-ebs-boot    amazon  available   public      i386    machine aki-94c527fd    ari-96c527ff        ebs
BLOCKDEVICEMAPPING  /dev/sda1       snap-a08912c9   15

We can see the EBS snapshot id snap-a08912c9 and the fact that it is 15 GB attached to /dev/sda1. If we start an instance of this AMI it will have a 15 GB EBS volume as the root disk and we won’t be able to change it once it’s running.

Now let’s run the EBS boot AMI, but we’ll override the default size, specifying 100 GB for the root disk device (/dev/sda1 as seen above):

ec2-run-instances   --key KEYPAIR   --block-device-mapping /dev/sda1=:100   ami-b232d0db

If we check the EBS volume mapped to the new instance we’ll see that it is 100GB, but when we ssh to the instance and check the root file system size we’ll notice that it is only showing 15 GB:

$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              15G  1.6G   13G  12% /

There’s one step left. We need to resize the file system so that it fills up the entire 100 GB EBS volume. Here’s the magic command for ext3. In my early tests it took 2-3 minutes to run. [Update: For Ubuntu 11.04 and later, this step is performed automatically when the AMI is booted and you don’t need to run it manually.]

$ sudo resize2fs /dev/sda1
resize2fs 1.40.4 (31-Dec-2007)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 7
Performing an on-line resize of /dev/sda1 to 26214400 (4k) blocks.
The filesystem on /dev/sda1 is now 26214400 blocks long.

Finally, we can check to make sure that we’re running on a bigger file system:

$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              99G  1.6G   92G   2% /

Note: The output reflects “99” instead of “100” because of slight differences in how df and EBS calculate “GB” (e.g., 1024 MB vs 1000 MB).


If it were possible to create an EBS boot AMI with an XFS root file system, then the resizing would be near instantaneous using commands like the following. [Update: For Ubuntu 11.04 and later, this step is performed automatically when the AMI is booted and you don’t need to run it manually.]

sudo apt-get update && sudo apt-get install -y xfsprogs
sudo xfs_growfs /

The Ubuntu kernels built for EC2 by Canonical have XFS support built in, so XFS based EBS boot AMIs might be possible. This would also allow for more consistent EBS snapshots.


Make sure you are running the latest version of the ec2-run-instances command. The current version can be determined with the command


To use EBS boot features, the version should be at least 1.3-45772.

[Updated 2009-12-11: Switch instructions to default us-east-1 since all regions now support this feature.]
[Updated 2011-12-13: Note that file system resize is done automatically on boot in Ubuntu 11.04 and later.]



I am following your instructions to resize the boot volume of an EBS AMI. However, when I run the command:

ec2-run-instances -k laptop2.priv -b /dev/sda1=:100 ami-b232d0db

I get the error

WARNING: Ignoring extra parameter(s): [ ami-b232d0db ]
Invalid argument for option '-b, --block-device-mapping MAPPING': '/dev/sda1' (-h for usage)

I am using API version 1.3-46266 2009-11-30


Erika: Based on the error message, it looks like you might have typed a space after "/dev/sda1" which does not belong there.


There is no space after /dev/sda1 in the statement /dev/sda1=:100.

I am running command line tools version 1.3-46266 2009-11-30



I found the answer to my problem at, in the last post.

This problem occurs when running EC2 commands from a Windows DOS shell. The solution is to put double quotation marks around /dev/sda1=:100, e.g. "/dev/sda1=:100" as described by TiNA


Erika: Glad you found the solution as I'm not the best person to ask about problems with Windows.

I have launched a CentOS EBS instance of 30 GB from a EBS Image of 10GB. How do I extend the root volume to 30GB in CentOS ? resizefs is not present in CentOS package repository.

santhoshsd: I switched from Red Hat products to Ubuntu about five years ago. You might want to ask this question in a CentOS forum, and feel free to post the answer here. Just in case this is the cause: the command is "resize2fs" not "resizefs".

I tried to do what you mention in the article, creating an XFS-formatted root volume, and it works!

It's possible using the recent Canonical Ubuntu AMI and kernel. Here's my article showing how to do this and how it can be used together with your ec2-consistent-snapshot utility.

Shlomo: Very nice, thanks! I'm a little concerned that if this were placed in a cron job, one might occasionally end up in a deadlock as the ec2-consistent-snapshot command tried to output messages which cron or syslog writes to a disk which is frozen by ec2-consistent-snapshot. I'm considering restructuring the message output so that they are buffered until the file system is unfrozen.

Is there also a way to reduce the size of an EBS volume? I would like to use the Ubuntu server images, but I really only need 2 GB (I use a separate volume for data).

You cannot run an instance with a smaller EBS boot disk than is specified by the AMI. You can, however, build your own EBS boot Ubuntu AMI with a smaller default EBS boot disk following a procedure similar to:

Can I use same procedure to reduce the 15GB Maverick AMI down to 10GB to fit the free EBS offer after 1st November?

Or is there a better way to have a 10GB Maverick server as EC2?

noiv11: No, you can't reduce the size of the boot disk less than the size of the AMI. If you'd like to have a smaller boot disk, you can build your own AMI starting with the downloadable images provided by Ubuntu:

See also:

Is it possible to reduce the size of EBS? I've been using their "free tier" which include 10GB of storage free of charge only.

ezconceptmail: You cannot start a 15GB AMI with less than 15GB on your EBS root disk. Hopefully, you can afford the $0.50-$0.55 extra cost for now. Ubuntu is evaluating reducing EBS boot AMIs to 10GB:

I couldn't get the instance to boot with a larger size when using its existing AMI, nor with another AMI created via the web gui (via the "create image (EBS AMI)" on the right-click menu of the instance). I noticed that the volume's "attachment information" would be stuck at "attaching" (instead of "attached"). The instance would boot if I didn't specify an increased size (via the "--block-device-mapping" option).

However, I did finally get it to work by manually creating a snapshot from the original volume, and then registering it as an AMI. Something is subtlely different here since I was able to successfully boot the instance with essentially the same cmd line as before (when it wasn't working).

This process either doesn't work or is out of date as of March 2011 with latest tools and Java. Doesn't seem to matter what AMI ID I use.

ec2-describe-images ami-b232d0db
IMAGE ami-b232d0db amazon/getting-started-with-ebs-boot amazon available public i386 machine aki-94c527fd ari-96c527ff

ec2-run-instances --key gsg-keypair --block-device-mapping /dev/sda1=:100 ami-b232d0db
Invalid argument for option '-B, --block-device-mapping MAPPING': '[Ljava.lang.String;@5eb7ec5d' (-h for usage)


It still works for me, though I've seen others complain about that error as far back as 2009, so it's probably not a tools version issue.

You wouldn't happen to be using Windows would you?

Hi Eric,

I am running out of space in my existing ubuntu instance on EC2. Is there documentation on how to increase the size of the /dev/sda1 partition for an existing instance?



Thanks, your article saved me lots to time , everything worked very well with no problems. I just had to change my command line a bit and make sure my certificates were in place. This is what I used. (I have the default Amazon Linux set up)

ec2-run-instances --key ***** -g sg-****** --block-device-mapping /dev/sda1=:15 ami-******* -t t1.micro --instance-initiated-shutdown-behavior terminate

Also I found this page very helpful for setting up the tools:

Keep the good work up!

Regards Dave

Having problems trying to resize2fs/dev/xvda2 on an 8GB RightScale Debian Squeeze instance, I get the "Filesystem is already etc etc blocks long" message.

Thinking there might be nothing I can do apart from migrate over to an Ubuntu 11.10 instance? (Which would be a pain, I'm running a populated ISPConfig 3 installation).....

...and ideas?



Unfortunately, there's insufficient information in your question for a diagnosis. Perhaps the RightScale folks could help as they built the AMI and know if there is anything special about how it is built (partitions?) and what you are doing.


It looks like RightScale built ami-0f01367b in eu-west-1 with a root EBS volume that is partitioned into three partitions:

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1 1 14 112423+ 83 Linux
/dev/xvda2 15 668 5253255 83 Linux
/dev/xvda3 669 1044 3020220 82 Linux swap / Solaris
This is not standard for EC2 EBS volumes as there is little benefit and there are a number of drawbacks.

One of the drawbacks is that you can't easily resize the volume and the file system with this AMI. You'd have to repartition the EBS volume while the system is stopped by attaching the volume to a different instance, them move it back and restart the instance.

I would recommend using an AMI that has an EBS root volume without partitions.

Hi Eric. I've kept this page bookmarked since you first published it in 2009, and have directed a lot of "How do I resize my ec2 instance?" questions here.

Today I was playing around with creating a t1.micro instance and specified a non-standard (20GB) root disk. I expected to run: sudo resize2fs /dev/sda1

But a funny thing happen on the way to resizing:

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1 20G 867M 18G 5% /

It appears that the instance root disk was sized correctly upon creation, no? If this is now the standard behavior, you may want to update this blog entry. Or "refudiate" me in a reply to this post ;-)


Yep, you'll note that I already had an [Update] message just above the resize2fs instruction pointing out that the file system is automatically resized since Ubuntu 11.04.

Thanks for the useful posts, Eric.

For a generic Linux instance the resize2fs is still necessary although the new size of the drive can be specified at launch time using the EC2 mgmt console.

$ uname -a
Linux xx.amzn1.x86_64 #1 SMP Fri Aug 24 05:34:49 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.9G 6.7G 1.2G 86% /
tmpfs 298M 0 298M 0% /dev/shm
$ sudo resize2fs /dev/sda1
resize2fs 1.42 (29-Nov-2011)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/sda1 to 3932160 (4k) blocks.
The filesystem on /dev/sda1 is now 3932160 blocks long.
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 15G 6.7G 8.0G 46% /
tmpfs 298M 0 298M 0% /dev/shm


Thanks for your notes. There is no such thing as "generic Linux". It looks like your comments apply to "Amazon Linux", which is a Linux distro provided by AWS.


This will not work for me. I'm trying on a separate EBS volume which mounted as /home" I did

1. Umount and detached the volume

2. Take the snapshot of the volume

3. Create a new large volume from that snapshot and attached to running instance.

4. Executed resize2fs, tune2fs etc. But it''s still showing old disk size even though fdisk -l showing new partition size. Still no luck

[root@]# fdisk -l /dev/xvdg | grep "/dev/xvdg"
Disk /dev/xvdg: 4294 MB, 4294967296 bytes
/dev/xvdg1 1 261 2096451 83 Linux
[root@]# df -h | grep -E "Filesystem |/dev/xvdg1"
Filesystem Size Used Avail Use% Mounted on
/dev/xvdg1 2.0G 1.5G 398M 80% /backup
[root@spredfashion parted-3.1]#




It looks like somebody might have put partitions on that EBS volume against the common practice. You'll need to resize partitions and possibly move them around before resizing the file system.

The de-facto standard and recommended practice with EC2 is to use the whole EBS volume as a single partitionless disk. Where you used partitions to divide up disks that were too big in real hardware, EBS allows you to create one volume of exactly the right size for each file system.

Leave a comment

Ubuntu AMIs

Ubuntu AMIs for EC2:

More Entries

When Are Your SSL Certificates Expiring on AWS?
If you uploaded SSL certificates to Amazon Web Services for ELB (Elastic Load Balancing) or CloudFront (CDN), then you will want to keep an eye on the expiration dates and…
Throw Away The Password To Your AWS Account
reduce the risk of losing control of your AWS account by not knowing the root account password As Amazon states, one of the best practices for using AWS is Don’t…
AWS Community Heroes Program
Amazon Web Services recently announced an AWS Community Heroes Program where they are starting to recognize publicly some of the many individuals around the world who contribute in so many…
EBS-SSD Boot AMIs For Ubuntu On Amazon EC2
With Amazon’s announcement that SSD is now available for EBS volumes, they have also declared this the recommended EBS volume type. The good folks at Canonical are now building Ubuntu…
EC2 create-image Does Not Fully "Stop" The Instance
The EC2 create-image API/command/console action is a convenient trigger to create an AMI from a running (or stopped) EBS boot instance. It takes a snapshot of the instance’s EBS volume(s)…
Finding the Region for an AWS Resource ID
use concurrent AWS command line requests to search the world for your instance, image, volume, snapshot, … Background Amazon EC2 and many other AWS services are divided up into various…
Changing The Default "ubuntu" Username On New EC2 Instances
configure your own ssh username in user-data The official Ubuntu AMIs create a default user with the username ubuntu which is used for the initial ssh access, i.e.: ssh ubuntu@<HOST>…
Default ssh Usernames For Connecting To EC2 Instances
Each AMI publisher on EC2 decides what user (or users) should have ssh access enabled by default and what ssh credentials should allow you to gain access as that user.…
New c3.* Instance Types on Amazon EC2 - Nice!
Worth switching. Amazon shared that the new c3.* instance types have been in high demand on EC2 since they were released. I finally had a minute to take a look…
Query EC2 Account Limits with AWS API
Here’s a useful tip mentioned in one of the sessions at AWS re:Invent this year. There is a little known API call that lets you query some of the EC2…
Using aws-cli --query Option To Simplify Output
My favorite session at AWS re:Invent was James Saryerwinnie’s clear, concise, and informative tour of the aws-cli (command line interface), which according to GitHub logs he is enhancing like crazy.…
Reset S3 Object Timestamp for Bucket Lifecycle Expiration
use aws-cli to extend expiration and restart the delete or archive countdown on objects in an S3 bucket Background S3 buckets allow you to specify lifecycle rules that tell AWS…
Installing aws-cli, the New AWS Command Line Tool
consistent control over more AWS services with aws-cli, a single, powerful command line tool from Amazon Readers of this tech blog know that I am a fan of the power…
Using An AWS CloudFormation Stack To Allow "-" Instead Of "+" In Gmail Email Addresses
Launch a CloudFormation template to set up a stack of AWS resources to fill a simple need: Supporting Gmail addresses with “-” instead of “+” separating the user name from…
New Options In ec2-expire-snapshots v0.11
The ec2-expire-snapshots program can be used to expire EBS snapshots in Amazon EC2 on a regular schedule that you define. It can be used as a companion to ec2-consistent-snapshot or…
Replacing a CloudFront Distribution to "Invalidate" All Objects
I was chatting with Kevin Boyd (aka Beryllium) on the ##aws Freenode IRC channel about the challenge of invalidating a large number of CloudFront objects (35,000) due to a problem…
Email Alerts for AWS Billing Alarms
using CloudWatch and SNS to send yourself email messages when AWS costs accrue past limits you define The Amazon documentation describes how to use the AWS console to monitor your…
Cost of Transitioning S3 Objects to Glacier
how I was surprised by a large AWS charge and how to calculate the break-even point Glacier Archival of S3 Objects Amazon recently introduced a fantastic new feature where S3…
Running Ubuntu on Amazon EC2 in Sydney, Australia
Amazon has announced a new AWS region in Sydney, Australia with the name ap-southeast-2. The official Ubuntu AMI lookup pages (1, 2) don’t seem to be showing the new location…
Save Money by Giving Away Unused Heavy Utilization Reserved Instances
You may be able to save on future EC2 expenses by selling an unused Reserved Instance for less than its true value or even $0.01, provided it is in the…
Installing AWS Command Line Tools from Amazon Downloads
This article describes how to install the old generation of AWS command line tools. For the most part, these have been replaced with the new AWS cli that is…
Convert Running EC2 Instance to EBS-Optimized Instance with Provisioned IOPS EBS Volumes
Amazon just announced two related features for getting super-fast, consistent performance with EBS volumes: (1) Provisioned IOPS EBS volumes, and (2) EBS-Optimized Instances. Starting new instances and EBS volumes with…
Which EC2 Availability Zone is Affected by an Outage?
Did you know that Amazon includes status messages about the health of availability zones in the output of the ec2-describe-availability-zones command, the associated API call, and the AWS console? Right…
Installing AWS Command Line Tools Using Ubuntu Packages
See also: Installing AWS Command Line Tools from Amazon Downloads Here are the steps for installing the AWS command line tools that are currently available as Ubuntu packages. These include:…
Ubuntu Developer Summit, May 2012 (Oakland)
I will be attending the Ubuntu Developer Summit (UDS) next week in Oakland, CA. ┬áThis event brings people from around the world together in one place every six months to…
Uploading Known ssh Host Key in EC2 user-data Script
The ssh protocol uses two different keys to keep you secure: The user ssh key is the one we normally think of. This authenticates us to the remote host, proving…
Seeding Torrents with Amazon S3 and s3cmd on Ubuntu
Amazon Web Services is such a huge, complex service with so many products and features that sometimes very simple but powerful features fall through the cracks when you’re reading the…
There are a number of CloudCamp events coming up in cities around the world. These are free events, organized around the various concepts, technologies, and services that fall under the…
Use the Same Architecture (64-bit) on All EC2 Instance Types
A few hours ago, Amazon AWS announced that all EC2 instance types can now run 64-bit AMIs. Though t1.micro, m1.small, and c1.medium will continue to also support 32-bit AMIs, it…
ec2-consistent-snapshot on GitHub and v0.43 Released
The source for ec2-conssitent-snapshot has historically been available here: ec2-consistent-snapshot on using Bazaar For your convenience, it is now also available here: ec2-consistent-snapshot on GitHub using Git You are…