Amazon EC2 instance root volume
When you launch an instance, we create a root volume for the instance. The root volume contains the image used to boot the instance. Each instance has a single root volume. You can add storage volumes to your instances when you launch them or after they are running.
We reserve specific device names for root volumes. For more information, see Device names on Linux instances.
Contents
Root volume type
You can launch an instance from either an instance store-backed AMI or an Amazon EBS-backed AMI.
The description of an AMI includes which type of AMI it is; you'll see the root device
referred to in some places as either ebs
(for Amazon EBS-backed) or instance store
(for instance store-backed). This is important because there are significant differences between
what you can do with each type of AMI. For more information about these differences, see
Storage for the root device.
We recommend that you use AMIs backed by Amazon EBS, because these instances launch faster and use
persistent storage.
Amazon EBS-backed instances
Instances that use Amazon EBS for the root volume automatically have an Amazon EBS volume attached. When you launch an Amazon EBS-backed instance, we create an Amazon EBS volume for each Amazon EBS snapshot referenced by the AMI you use. You can optionally use other Amazon EBS volumes or instance store volumes, depending on the instance type.
An Amazon EBS-backed instance can be stopped and later restarted without affecting data stored in the attached volumes. There are various instance– and volume-related tasks you can do when an Amazon EBS-backed instance is in a stopped state. For example, you can modify the properties of the instance, change its size, or update the kernel it is using, or you can attach your root volume to a different running instance for debugging or any other purpose. For more information, see Amazon EBS volumes.
Limitation
You can't use st1
or sc1
EBS volumes as root volumes.
Instance failure
If an Amazon EBS-backed instance fails, you can restore your session by following one of these methods:
-
Stop and then start again (try this method first).
-
Automatically snapshot all relevant volumes and create a new AMI. For more information, see Create an Amazon EBS-backed Linux AMI.
-
Attach the volume to the new instance by following these steps:
-
Create a snapshot of the root volume.
-
Register a new AMI using the snapshot.
-
Launch a new instance from the new AMI.
-
Detach the remaining Amazon EBS volumes from the old instance.
-
Reattach the Amazon EBS volumes to the new instance.
-
Instance store-backed instances
Instances that use instance stores for the root volume automatically have one or more instance store volumes available, with one volume serving as the root volume. When an instance is launched, the image that is used to boot the instance is copied to the root volume. Note that you can optionally use additional instance store volumes, depending on the instance type.
Any data on the instance store volumes persists as long as the instance is running, but this data is deleted when the instance is terminated (instance store-backed instances do not support the Stop action) or if it fails (such as if an underlying drive has issues). For more information, see Amazon EC2 instance store.
Requirement
Only the following instance types support an instance store volume as the root volume: C3, D2, G2, I2, M3, and R3.
Instance failure
After an instance store-backed instance fails or terminates, it cannot be restored. If you plan to use Amazon EC2 instance store-backed instances, we highly recommend that you distribute the data on your instance stores across multiple Availability Zones. You should also back up critical data from your instance store volumes to persistent storage on a regular basis.
Choose an AMI by root volume type
The AMI that you specify when you launch your instance determines the type of root device volume that your instance has. You can view AMIs by root device type using one of the following methods.
Determine the root device type of your instance
Change the root volume to persist
By default, the root volume for an AMI backed by Amazon EBS is deleted when the instance
terminates. You can change the default behavior to ensure that the volume persists after the
instance terminates. To change the default behavior, set the DeleteOnTermination
attribute to false
using a block device mapping.
Tasks
Configure the root volume to persist during instance launch
You can configure the root volume to persist when you launch an instance using the Amazon EC2 console or the command line tools.
Configure the root volume to persist for an existing instance
You can configure the root volume to persist for a running instance using the command line tools only.
Confirm that a root volume is configured to persist
You can confirm that a root volume is configured to persist using the Amazon EC2 console or the command line tools.
Change the initial size of the root volume
By default, the size of the root volume is determined by the size of the snapshot. You can increase the initial size of the root volume using the block device mapping of the instance as follows.
-
Determine the device name of the root volume specified in the AMI, as described in View the EBS volumes in an AMI block device mapping.
-
Confirm the size of the snapshot specified in the AMI block device mapping.
-
Override the size of the root volume using the instance block device mapping, as described in Update the block device mapping when launching an instance, specifying a volume size that is larger than the snapshot size.
For example, the following entry for the instance block device mapping increases the size
of the root volume, /dev/xvda
, to 100 GiB. You can omit the snapshot ID in
the instance block device mapping because the snapshot ID is already specified in the AMI block
device mapping.
{ "DeviceName": "/dev/xvda", "Ebs": { "VolumeSize": 100 } }
For more information, see Block device mappings.