I have an Amazon EC2 instance that is running a simple LAMP stack with Amazon's flavor of linux. I want to stop it and add more disk space. We will need more than our current 8 gigabytes.
I was wondering:
When I stop my instance what will be lost? Will the content of /var/www be lost? What does this mean? I am sure my instance isn't a spot instance.
- What is an ephemeral disk? Is my instance completely ephemeral? Are parts of it ephemeral? When I press "stop", probably, not everything is cleared. So what is cleared?
Amazon has tools in the Management Console to facilitate enlarging an instance?
Will I have to re-partition the instance? Can an instance expand the partition it is running on?
Respuesta1
Since your instance currently has 8 GB on the root disk, it is probably an EBS boot instance. This means that your file system will be kept intact through a "stop"/"start" cycle, but you will (by default) lose everything if you "terminate" the instance.
Here's an article I wrote that describes what happens when you stop/start an instance (and when you simply reboot):
Rebooting vs. Stop/Start of Amazon EC2 Instance
http://alestic.com/2011/09/ec2-reboot-stop-start
Here's an article I wrote that describes how to increase the size of your EBS root volume:
Resizing the Root Disk on a Running EBS Boot EC2 Instance
http://alestic.com/2010/02/ec2-resize-running-ebs-root
These articles should answer most of the questions your list.
Respuesta2
Your data (both software and files) should be stored on an EBS volume (unless you have specific requirements that favour an ephemeral volume).
If the above is true (i.e. you have an EBS root volume), it is easy enough to add more space.
1) When I stop my instance what will be lost? Will the content of /var/www be lost? What does this mean? I am sure my instance isn't a spot instance.
When you stop your instance, you will lose:
- All data on ephemeral disks
- The IP addresses of the instance (except for an Elastic IP)
Spot instances cannot be stopped (only terminated)
2) Amazon does NOT have tools that directly allow for resizing a volume, but this can be accomplished using the available tools, in conjunction with some command on the server. Essentially:
- Take a snapshot of the EBS volume
- Create a new (larger) volume from the snapshot
- Attach the new volume to an instance and resize the filesytem (i.e. resize2fs for ext4)
- Detach the original root volume from your original instance, and attach the new volume
3) As mentioned above, the 'partition' size is limited by the size of the EBS volume. It is pointless to create an EBS volume larger than the size of the partitions it contains (as you pay for allocated space, not used space). It may be advisable to move all your data off the root volume. Create and attach a second EBS volume to the instance instead of making the root volume larger. In addition to separating the system software and your data, this reduces the data included in snapshots, and should make any future changes to your disk size easier.
Respuesta3
1) When I stop my instance what will be lost? Will the content of /var/www be lost? What does this mean? I am sure my instance isn't a spot instance. What is an ephemeral disk? Is my instance completely ephemeral? Are parts of it ephemeral? When I press "stop", probably, not everything is cleared. So what is cleared?
Only specially mounted storage is lost. It appears that this storage is not mounted by default, although Amazon's tools produce a warning about ephemeral storage independent of its utilization.
2) Amazon has tools in the Management Console to facilitate enlarging an instance?
Yes
3) Will I have to re-partition the instance? Can an instance expand the partition it is running on? resize2fs handle's the resize.