Skip to content

Instantly share code, notes, and snippets.

@joshdvir
Created October 28, 2011 06:41
Show Gist options
  • Save joshdvir/1321758 to your computer and use it in GitHub Desktop.
Save joshdvir/1321758 to your computer and use it in GitHub Desktop.
Creating a larger EBS system from an AMI
Commands to create larger EBS filesystem then came:
First choose your AMI - you should know that.
# check information on you AMI like size of root mount.
ec2-describe-images <ami-xxxxxxxx>
# Start a new server based on the ami with a 30GB size root mount
ec2-run-instances --key <KEY RING NAME> --block-device-mapping /dev/sda1=:30 <ami-xxxxxxxx>
# run "df -h" and see the size still what it was 8GB.
# the out put will be like:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.9G 727M 6.8G 10% /
# connect to the new server - I don't need to tell you how to do this.
# and run the following command
# this command assumes that the root mount is /dev/sda1
# this command will resize the root mount to fit the new 30GB size.
sudo resize2fs /dev/sda1
# the out put will be like:
ubuntu@domU-12-31-38-04-6A-91:~$ sudo resize2fs /dev/sda1
resize2fs 1.41.11 (14-Mar-2010)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/sda1 to 7864320 (4k) blocks.
The filesystem on /dev/sda1 is now 7864320 blocks long.
# Now you can run "df -h" and see the new size.
# the out put will be like:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 30G 731M 28G 3% /
That's it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment