i am pretty to new to amazon web services. I have a few ubuntu 10.04 instances running but today when i tried to login to my instance, i got an error saying "insufficient disk space in root". I managed to login after a few min and removed all the unwanted files. In the instance description, it is mentioned that a large instance has 850 GB of storage but for the root , its only 8 GB. I came across this article to increase the root size but the commands are run from a linux shell i guess and i have ec2 tools setup on my windows machine.

Could some one tell me how do i run these commands mentioned in the article on a windows shell? Few questions that i have about EC2 in general:

  1. what is the difference between the 850 GB storage available for the large instance and the allotted 8 GB?
  2. I read that i can detach a volume from a instance that has gone bad and attach it to a new instance, how do i do this? And will the saved data be available in this volume?

There are a number possibilities when dealing with storage on AWS.

First off, there is instance-storage (the 850 GB you are talking off). This storage is hooked to your EC2-instance. It can not be moved or recovered to another instance once the instance is gone. This is useful to store thing of low importance. (OS files, files to process, ...). When the instance is gone, your data is also gone.

Then there are EBS-blocks. These are like hard drives you can attach to any EC2-instance that holds your data persistent, whether your EC2-instance goes down or not. When you need the drive for another instance, just detach it and reattach it. The size of an EBS block is predefined. When you run out of space, add another one. Resizing is not really possible (unless you use the hacky way described in the link you provided).

Lastly you can use an S3-Bucket. Your can store as much data as you want in these buckets. It works a bit like EBS but has no real filesystem implementation. Some sites use this to host their images etc.

So, for your problem:

You should be able to run them using the ec2-tools. Q1 & 2 I think I addressed above. As always with AWS. Don't get attached to EC2-instaces. When they go bad, get rid of them and set up a new one by using a pre made image and attach your EBS-blocks.

  • Thanks for the explanation, so how do i place my important data on the EBS block. Is the default 8 GB store the EBS block? How do i differentiate the 2 storage types? I donot see any separate drives under the file system. – Nithin Dec 19 '11 at 11:02
  • Since you are using the EBS-block as the root volume, you can't use storage-space. All your data is on EBS now. I would suggest spinning up a new EC2-instance, installing everything, attaching your EBS-block and create a new EBS block to store all your data from now on. Then you can delete the old one. – Bart De Vos Dec 19 '11 at 11:07
  • Correct me if i am wrong, i need to stop my current instance, detach the volume associated with that instance, bring up a new instance and attach the old volume to this new instance? Finally attach an other volume and move my data to that volume? Will the volumes appears as separate drives? Thanks. – Nithin Dec 19 '11 at 11:21
  • Correct. It will show up as a different drive but will not be mounted. You'll have to do this yourself. – Bart De Vos Dec 19 '11 at 11:39
  • I managed to create a new volume of 100 GB and attach it to my large instance. I followed this article to make the attached drive usable and pointed it to a directory /drive1 . But as per the article i need to add this : /dev/sdg /drive1 auto defaults,nobootwait,noatime 0 0 to /etc/fstab . So if have to detach this volume and attach it to a different instance, do i need to add that line in the new instance as well? Thanks – Nithin Dec 20 '11 at 6:10

you can find a pretty detailed explanation here: http://alestic.com/2009/12/ec2-ebs-boot-resize

The Large Instance has 850 GB of storage size, and that one is divided into two 420 GB volumes, plus 10 GB or root partition. The two big volumes are not "activated" at launch. This happens when you launch EBS-backed AMIs.

  • I am using the ami : ami-e8205aba which is a ubuntu EBS backed ami. But i dont see the 2 420 GB volumes you are talking about. How do i access these ? Thanks. – Nithin Dec 19 '11 at 11:11

The 850 GB storage is ephemeral - it does not persist once the instance is stopped/terminated; you do not incur any charge for it (neither for I/O nor provisioned storage). For the m1.large, the two volumes usually show up as /dev/xvdb and /dev/xvdc. For instances that have an EBS root, ephemeral storage is only added if explicitly included (i.e. with --block-device-mapping) in either the AMI (ec2-register) or the launch command (ec2-run-instances). If an instance does not have the added storage, it cannot be added to it (without launching a new instance).

Of the commands mentioned in the article, all those beginning with ec2-* (i.e. the api tools) can be run from anywhere (e.g. your windows machine, or another instance, or the instance in question). While the others need to be run on the instance itself (via SSH).

Instead of using the API tools, you can use the AWS console to perform the same tasks (stop, detach, snapshot, create EBS volume, attach) - but you will need to perform the resize2fs directly on the instance itself.

It is worth noting that by default, most root EBS volumes are not set to persist after termination of the instance (while any EBS volumes you manually attach will persist by default). You can change this behaviour by using: ec2-modify-instance-attribute INSTANCE_ID -b "MOUNT_POINT=VOLUME_ID:false" (the 'false' specifies not to delete on termination). You can determine whether or not an EBS volume will be deleted on termination with ec2-describe-instance-attribute INSTANCE_ID -v -b (or by using the AWS console).

For as long as your EBS volume exists, all the data on it persists. If an instance 'goes bad' (presuming it is not a problem with your setup), and the EBS volume still exists, you can attach it to another instance, either as the root volume, or as an additional volume, and it should function without issue. It is advisable, however, that you have some snapshots of your EBS volumes (they aren't above failure), and that you separate your data from the software (i.e. use multiple EBS volumes).

To place your important data on an EBS volume (presumably you already have it on the root volume), you can attach a second EBS volume, and mount -o bind the locations from your root volume to your additional volume. Despite an instance-store root volume being available, using an EBS root is preferable in terms of portability and ability to recover.

  • Thanks for the detailed explaination. How ever i did find one 420 GB volume mounted as /mnt by default. – Nithin Dec 26 '11 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.