Booting an Alestic EC2 Image with a Larger Root Disk
published May 06, 2011
I always start up my new EC2 images using Alestic’s awesome Ubuntu images.
I typically pick the EBS boot images. My only complaint has been that the EBS size is too small. They’re only 8 GB by default.
In the past, the fix has been to follow these directions: start up a server, terminate it, detach the volume, make a snapshot of it, create a new AMI from the snapshot and then start up a new server with that AMI.
Too much work for me.
Today I was starting up another server, and I did a bit of googling and found out that with the latest images, you can just pass in a parameter to your ec2-run-instances command and set the boot disk size to anything you want. Woo hoo!
Here’s the google groups thread. Look for the message from Scott Moser.
Here’s the command I used to create a new instance with a 100GB boot disk:
ec2-run-instances --key your-ec2-key \ --block-device-mapping /dev/sda1=:100:false \ --instance-initiated-shutdown-behavior stop \ --disable-api-termination --instance-type m1.small ami-06ad526f
The magic part is the
--block-device-mapping /dev/sda1=:100:false. This takes three params. The first (which is blank here) allows you to pick a volume to mount as the root. If it’s blank, then a new EBS volume will be created.
The second (
100) is the size of the boot disk. Change the 100 there to be whatever you want the size of the boot disk to be, in GB.
The third is whether or not to destroy the volume when you kill the instance, and can be either
false. Unless this is a throwaway instance, you’re going to want this to be