

# Amazon EBS volume lifecycle
<a name="ebs-volume-lifecycle"></a>

The lifecycle of an Amazon EBS volume starts with the creation process. You can create a volume from an Amazon EBS snapshot or you can create an empty volume. Before you can use your volume, you must attach it to one or more Amazon EC2 instances that are in the same Availability Zone as the volume. You can attach multiple volumes to an instance. If needed, you can detach a volume from one instance and then attach it to another instance. If your storage requirements change, you can modify the size or performance of the volume at any time. You can create point-in-time backups of your volumes by creating Amazon EBS snapshots. If you no longer need a volume, you can delete it to stop incurring the related storage costs.

The following image shows actions that you can perform on your volumes as part of the volume lifecycle. There are also tasks that you perform by connecting to the instance and running an operating system command. For example, formatting the volume, mounting the volume, managing partitions, and viewing the free disk space.

![\[The lifecycle of an EBS volume.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/volume-lifecycle.png)


**Topics**
+ [Create a volume](ebs-creating-volume.md)
+ [Copy a volume](ebs-copying-volume.md)
+ [Attach a volume to an instance](ebs-attaching-volume.md)
+ [Attach a volume to multiple instances](ebs-volumes-multi.md)
+ [Make a volume available for use](ebs-using-volumes.md)
+ [View volume details](ebs-describing-volumes.md)
+ [Modify a volume](ebs-modify-volume.md)
+ [Detach a volume from an instance](ebs-detaching-volume.md)
+ [Delete a volume](ebs-deleting-volume.md)

# Create an Amazon EBS volume
<a name="ebs-creating-volume"></a>

You can create an Amazon EBS volume and then attach it to any EC2 instance in the same Availability Zone.

You can either **create an empty volume**, or you can **create a volume from an Amazon EBS snapshot**. If you create a volume from a snapshot, the volume begins as an exact replica of the volume that was used to create that snapshot.

**Volume initialization**  
When you create a volume from a snapshot, the storage blocks from the snapshot must be downloaded from Amazon S3 and written to the volume before you can access them. This process is called volume initialization. During this time, the volume will experience increased I/O latency. Full volume performance is achieved only after all storage blocks have been downloaded and written to the volume.

The default volume initialization rate fluctuates throughout the initialization process, which could make completion times unpredictable.

To minimize the performance impacts associated with volume initialization, you can use an Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate) or fast snapshot restore. For more information, see [Initialize Amazon EBS volumes](initalize-volume.md).

**Volume encryption**  
The encryption state of the volume depends on whether your account is [enabled for encryption by default](encryption-by-default.md), and on the encryption state of the snapshot, if you choose to use one. The following table summarizes thepossible encryption outcomes.


| Encryption by default | Snapshot used? | Volume encryption outcome | Note | 
| --- | --- | --- | --- | 
| Disabled | No | Optional encryption | If you enable encryption, you can specify the KMS key to use. If you enable encryption but do not specify a KMS key, the AWS managed key (aws/ebs) is used. | 
| Disabled | Yes, unencrypted | Optional encryption | If you enable encryption, you can specify the KMS key to use. If you enable encryption but do not specify a KMS key, the AWS managed key (aws/ebs) is used. | 
| Disabled | Yes, encrypted | Automatic encryption | You can specify the KMS key to use. If you do not specify a KMS key, the volume is encrypted using the same KMS key as the source snapshot. | 
| Enabled | No | Automatic encryption | You can specify the KMS key to use. If you do not specify a KMS key, the key specified for encryption by default is used. | 
| Enabled | Yes, unencrypted | Automatic encryption | You can specify the KMS key to use. If you do not specify a KMS key, the key specified for encryption by default is used. | 
| Enabled | Yes, encrypted | Automatic encryption | You can specify the KMS key to use. If you do not specify a KMS key, the volume is encrypted using the same key as the source snapshot (console), or the key specified for encryption by default (CLI/API). | 

**Additional considerations**
+ Volumes must be attached to instances in the same Availability Zone.
+ Volumes are ready for use only after they enter the `available` state.
+ When you create a volume using the console, `gp3` is the default volume type. For the command line tools, API, and SDK, `gp2` is the default volume type. 
+ To use a volume with an instance running on an outpost, you must create the volume on the same outpost as the instance. 
+ If you create a volume for use with a Windows instance, and it's larger than 2048 GiB, ensure that you configure the volume to use GPT partition tables. For more information, see [Amazon EBS volume constraints](volume_constraints.md) and [ Windows support for disks larger than 2 TB.](https://learn.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/support-for-hard-disks-exceeding-2-tb).
+ Volumes are also created indirectly by launching an Amazon EC2 instance. Either the AMI used to launch the instance, or the instance launch request itself could include block device mappings for Amazon EBS volumes. For more information, see [Block device mappings](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html).

------
#### [ Console ]

**To create a volume**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes** and then choose **Create volume**.

1. (*Outpost customers only*) For **Outpost ARN**, enter the ARN of the AWS Outpost on which to create the volume.

1. For **Volume type**, choose the type of volume to create. For more information about the available volume types, see [Amazon EBS volume types](ebs-volume-types.md).

1. For **Size**, enter the size of the volume, in GiB. For more information, see [Amazon EBS volume constraints](volume_constraints.md).

1. (*For `io1`, `io2`, and `gp3` only*) For **IOPS**, enter the maximum number of input/output operations per second (IOPS) that the volume should provide.

1. (*For `gp3` only*) For **Throughput**, enter the throughput that the volume should provide, in MiB/s.

1. For **Availability Zone**, choose the Availability Zone in which to create the volume.

1. For **Snapshot ID**, do one of the following:
   + To create an empty volume, keep the default value (**Don't create volume from a snapshot**).
   + To create the volume from a snapshot, select the snapshot to use.

1. If you have selected a snapshot, for **Volume initialization rate**, you can optionally specify the volume initialization rate, in MiB/s, at which the snapshot blocks are to be downloaded from Amazon S3 to the volume after creation. For more information, see [Use an Amazon EBS Provisioned Rate for Volume Initialization](initalize-volume.md#volume-initialization-rate). To use the default initialization rate or fast snapshot restore (if it is enabled for the selected snapshot), don't specify a rate.

1. (*`io1` and `io2` only*) To enable the volume for Amazon EBS Multi-Attach, select **Enable Multi-Attach**. For more information, see [Attach an EBS volume to multiple EC2 instances using Multi-Attach](ebs-volumes-multi.md).

1. Set the encryption status for the volume.
   + If your account is enabled for [encryption by default](encryption-by-default.md), encryption is automatic and can't be disabled.
   + If you selected an encrypted snapshot, encryption is automatic and can't be disabled.
   + If your account is not enabled for [encryption by default](encryption-by-default.md), and you select an unencrypted snapshot or do not select a snapshot, encryption is optional.

1. (*Optional*) To assign custom tags to the volume, in the **Tags** section, choose **Add tag**, and then enter a tag key and value pair.

1. Choose **Create volume**.

1. To use the volume, wait for it to reach the `available` state and then attach it to an Amazon EC2 instance in the same Availability Zone. For more information, see [Attach an Amazon EBS volume to an Amazon EC2 instance](ebs-attaching-volume.md).

------
#### [ AWS CLI ]

**To create a volume**  
Use the [create-volume](https://docs.aws.amazon.com/cli/latest/reference/ec2/create-volume.html) command. The following example creates an empty gp3 volume with a size of 100 GiB in the specified Availability Zone.

```
aws ec2 create-volume \
    --volume-type gp3 \
    --size 100 \
    --availability-zone us-east-1a
```

------
#### [ PowerShell ]

**To create a volume**  
Use the [New-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Volume.html) cmdlet. The following example creates an empty gp3 volume with a size of 100 GiB in the specified Availability Zone.

```
New-EC2Volume `
    -VolumeType gp3 `
    -Size 100 `
    -AvailabilityZone us-east-1a
```

------

# Copy an Amazon EBS volume
<a name="ebs-copying-volume"></a>

You can create an instant point-in-time copy of an Amazon EBS volume within the same Availability Zone. A volume copy begins as a crash-consistent, point-in-time copy of the source volume. It includes all the data blocks written to the source volume at the time the volume copy initialization begins. The volume copy gets its own unique volume ID. Volume copies are created immediately and can be attached to an Amazon EC2 instance once it reaches the `available` state. Using volume copies, you can quickly copy your production data for test and development environments.

## Initialization
<a name="copy-volume-initialization"></a>

Volume copies are initialized after creation. During initialization, the data blocks are copied from the source volume and written to the volume copy in the background. The volume remains in the `initializing` state until initialization completes.

**Performance during initialization**  
Copy operations do not affect the performance of the source volume. You can continue using the source volume normally during the copy process. Copied volumes can be accessed instantly without waiting for the data to be copied from the source volume. Volume copies provide instant access to data with single-digit millisecond latency, however, actual latency might vary depending on the volume type. During initialization, the volume copy delivers **baseline performance** equal to the lowest of the following three values:
+ 3,000 IOPS and 125 MiB/s
+ The provisioned performance for the **source volume**
+ The provisioned performance for the **volume copy**

The volume copy can exceed the baseline performance when the following criteria are met:

1. Both the source volume and volume copy are provisioned with more than 3,000 IOPS and 125 MiB/s.

1. The source volume has unutilized performance capacity (driven performance is less than provisioned performance).

For example, if the source volume is provisioned with 10,000 IOPS and your workload is currently driving only 5,000 IOPS, and the volume copy is provisioned with 10,000 IOPS, the volume copy can achieve performance higher than the 3,000 IOPS baseline performance during initialization by using the source volume's unutilized 5,000 IOPS.

**Initialization duration**  
The time it takes to initialize a volume copy depends on the size of the block data written to the source volume at the time of creating the volume copy. Volume copies are initialized on a best-effort basis, with the following general guidelines. For the first 1 TiB of data blocks, volume initialization takes up to 6 hours. For each subsequent 1 TiB of data blocks up to 16 TiB, initialization takes 1.2 hours per TiB. For written data larger than 16 TiB, initialization takes 24 hours.

**Monitor initialization progress**  
You can monitor the initialization progress using the [describe-volume-status](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volume-status.html) AWS CLI command or Amazon EventBridge. For more information, see [Monitor the status of Amazon EBS volume initialization](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-initialize-monitor.html).

## Encryption
<a name="copy-volume-encryption"></a>

Copies of encrypted volumes are automatically encrypted with the same KMS key as the source volume. You can't copy unencrypted volumes.

## Considerations
<a name="copy-volume-consids"></a>
+ You can create copies from encrypted source volumes only. You can't create copies from unencrypted source volumes.
+ You can create only one volume copy from a source volume at a time. You can create subsequent copies of the same source volume only once the previous volume copy has been fully initialized.
+ You can have a maximum of 5 in-progress volume copies per Region. If you exceed this quota, you get the `CopyVolumesLimitExceeded` error. You can [request a quota increase](https://docs.aws.amazon.com/servicequotas/latest/userguide/request-quota-increase.html) if needed.
+ The volume copy must be created in the same Availability Zone as the source volume.
+ The size of the volume copy must be equal to or greater than the size of the source volume.
+ You can't copy a volume copy while it is being created or initialized.
+ To create a volume copy, the source volume must be in the `available` or `in-use` state, and volume modifications must be in the `completed` or `optimizing` state.
+ Volume copies are subject to the same account and Regional storage and IOPS quotas as regular Amazon EBS volumes. For more information, see [Amazon EBS quotas](https://docs.aws.amazon.com/general/latest/gr/ebs-service.html#limits_ebs).
+ If you delete the source volume while the copy operation is in progress, the copy operation still completes.
+ Tags assigned to the source volume are not assigned to the volume copy.
+ You can't create copies from volumes on Outposts or in Wavelength Zones.

## Pricing
<a name="copy-volume-pricing"></a>

When you initiate a volume copy operation, you are charged a one-time fee per GiB of data blocks written to the volume copy. After the volume copy is created, it is charged the same way as any other Amazon EBS volume in your account. For more information, see [Amazon EBS pricing](https://aws.amazon.com/ebs/pricing/).

## Copy a volume
<a name="copy-volume-copy"></a>

Use one of the following methods to copy an Amazon EBS volume.

------
#### [ Console ]

**To copy a volume**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**.

1. Select the volume to copy and choose **Actions**, **Copy volume**.

1. For **Volume type**, choose the volume type for the copy. The default volume type is **gp3**.

1. For **Size**, enter the size for the volume copy, in GiBs. The size must be equal to or greater than the size of the source volume.

1. (*`io1`, `io2`, and `gp3` only*) For **IOPS**, enter the maximum number of input/output operations per second (IOPS) for the volume copy.

1. (*`gp3` only*) For **Throughput**, enter the throughput for the volume copy, in MiB/s.

1. (*`io1` and `io2` only*) To enable the volume copy for Amazon EBS Multi-Attach, select **Enable Multi-Attach**.

1. (*Optional*) To assign custom tags to the volume copy, in the **Tags** section, choose **Add tag**, and then enter a tag key and value pair.

1. Choose **Copy volume**.

1. The copied volume enters the `creating` state and then transitions to `available` shortly after. You can then attach it to an Amazon EC2 instance in the same Availability Zone.

------
#### [ AWS CLI ]

**To copy a volume**  
Use the [copy-volumes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/copy-volumes.html) command.

The following example creates a volume copy of `vol-01234567890abcdef` with the `gp3` volume type, a size of `100` GiB, and throughput of `250` MiB/s.

```
aws ec2 copy-volumes \
--source-volume-id vol-01234567890abcdef \
--volume-type gp3 \
--size 100 \
--throughput 250
```

------
#### [ PowerShell ]

**To copy a volume**  
Use the [Copy-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/Copy-EC2Volume.html) cmdlet.

The following example creates a volume copy of `vol-01234567890abcdef` with the `gp3` volume type, a size of `100` GiB, and throughput of `250` MiB/s.

```
Copy-EC2Volume `
-SourceVolumeId vol-01234567890abcdef `
-VolumeType gp3 `
-Size 100 `
-Throughput 250
```

------

# Attach an Amazon EBS volume to an Amazon EC2 instance
<a name="ebs-attaching-volume"></a>

You can attach an available EBS volume to one or more of your instances that is in the same Availability Zone as the volume.

For information about adding EBS volumes to your instance at launch, see [instance block device mapping](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#instance-block-device-mapping).

**Considerations**
+ The maximum number of Amazon EBS volumes that you can attach to an instance depends on the instance type. If you exceed the volume attachment limit for an instance type, the attachment request fails with the `AttachmentLimitExceeded` error. For more information, see [Instance volume limits](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html).
+ You can attach volumes to instances that are in the same Availability Zone only.
+ Multi-Attach enabled volumes can be attached to up to 16 instances. For more information, see [Attach an EBS volume to multiple EC2 instances using Multi-Attach](ebs-volumes-multi.md).
+ If the volume has an AWS Marketplace product code:
  + You can attach it to a stopped instance only.
  + You must be subscribed to the AWS Marketplace code that is on the volume.
  + The instance's configuration, such as its type and operating system, must support that specific AWS Marketplace code. For example, you cannot take a volume from a Windows instance and attach it to a Linux instance.
  + AWS Marketplace codes are copied from the volume to the instance.
+ This device name you specify is used by Amazon EC2. The block device driver can mount the device with a device name that is different from the one you specify. For more information, see [Device names for volumes on Amazon EC2 instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html).
+ In some cases, a volume other than the volume attached to `/dev/xvda` or `/dev/sda` can become the root volume for the instance. This can happen if you attach the root volume of another instance, or a volume created from the snapshot of a root volume, to an instance with an existing root volume. For more information, see [ Boot from the wrong volume](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-booting-from-wrong-volume.html).
+ Some instance types support more than one EBS card. You can select the EBS card for the volume to be attached to by specifying the EBS card index. For instances support multiple EBS cards, see [ EBS cards](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs_cards.html).
  + Your root volume must be attached to EBS card index `0`.
  + For the instances that support multiple EBS cards, If you do not specify the EBS card index, your volume will be attached to EBS card index `0`.
  + When configuring your EC2 instances for high-performance workloads, it is essential to balance EBS volumes across EBS cards based on performance requirements, to avoid running into performance limits on any of the EBS cards.
  + The volume attachment limit for an instance type is spread equally across each EBS card. For example, on an EC2 instance that supports `128` volume attachments with 2 EBS cards, each EBS card can support up to `64` volume attachments. If you exceed the EBS card attachment limit, the request fails with the `CardAttachmentLimitExceeded` error.

------
#### [ Console ]

**To attach an EBS volume to an instance**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**.

1. Select the volume to attach and choose **Actions**, **Attach volume**.

1. For **Instance**, enter the ID of the instance or select the instance from the list of options.

1. For **Device name**, do one of the following:
   + For a root volume, select the required device name from the **Reserved for root volume** section of the list. Typically `/dev/sda1` or `/dev/xvda` for Linux instances depending on the AMI, or `/dev/sda1` for Windows instances.
   + For data volumes, select an available device name from the **Recommended for data volumes** section of the list.
   + To use a custom device name, select **Specify a custom device name** and then enter the device name to use.

1. Choose **Attach volume**.

1. Connect to the instance and mount the volume. For more information, see [Make an Amazon EBS volume available for use](ebs-using-volumes.md).

------
#### [ AWS CLI ]

**To attach an EBS volume to an instance**  
Use the [attach-volume](https://docs.aws.amazon.com/cli/latest/reference/ec2/attach-volume.html) command. The following example attaches the specified volume to the specified instance using the specified device name.

```
aws ec2 attach-volume \
    --volume-id vol-01234567890abcdef \
    --instance-id i-1234567890abcdef0 \
    --device /dev/sdf
```

------
#### [ PowerShell ]

**To attach an EBS volume to an instance**  
Use the [Add-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/Add-EC2Volume.html) cmdlet. The following example attaches the specified volume to the specified instance using the specified device name.

```
Add-EC2Volume `
    -VolumeId vol-01234567890abcdef `
    -InstanceId i-1234567890abcdef0 `
    -Device /dev/sdf
```

------

# Attach an EBS volume to multiple EC2 instances using Multi-Attach
<a name="ebs-volumes-multi"></a>

Amazon EBS Multi-Attach enables you to attach a single Provisioned IOPS SSD (`io1` or `io2`) volume to multiple instances that are in the same Availability Zone. You can attach multiple Multi-Attach enabled volumes to an instance or set of instances. Each instance to which the volume is attached has full read and write permission to the shared volume. Multi-Attach makes it easier for you to achieve higher application availability in applications that manage concurrent write operations.

**Pricing and billing**  
There are no additional charges for using Amazon EBS Multi-Attach. You are billed the standard charges that apply to Provisioned IOPS SSD (`io1` and `io2`) volumes. For more information, see [Amazon EBS pricing](https://aws.amazon.com/ebs/pricing/).

**Topics**
+ [Considerations and limitations](#considerations)
+ [Performance for Multi-Attach volumes](ebs-multi-attach-perf.md)
+ [Enable Multi-Attach](working-with-multi-attach.md)
+ [Disable Multi-Attach](disable-multi-attach.md)
+ [NVMe reservations](nvme-reservations.md)

## Considerations and limitations
<a name="considerations"></a>
+ Multi-Attach enabled volumes can be attached to up to 16 instances built on the [ Nitro System](https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html) that are in the same Availability Zone.
+ **Linux instances** support Multi-Attach enabled `io1` and `io2` volumes. **Windows instances** support Multi-Attach enabled `io2` volumes only.
+ The maximum number of Amazon EBS volumes that you can attach to an instance depends on the instance type and instance size. For more information, see [ instance volume limits](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html).
+ Multi-Attach is supported exclusively on [Provisioned IOPS SSD (`io1` and `io2`) volumes](provisioned-iops.md#EBSVolumeTypes_piops).
+ Multi-Attach for `io1` volumes is available in the following Regions only: US East (N. Virginia), US West (Oregon), and Asia Pacific (Seoul).

  Multi-Attach for `io2` is available in all Regions that support `io2`.
**Note**  
For better performance, consistency, and durability at a lower cost, we recommend that you use `io2` volumes.
+ `io1` volumes with Multi-Attach enabled are not supported with [instances built on the Nitro System](https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html) that support the Scalable Reliable Datagram (SRD) networking protocol only. To use Multi-Attach with these instance types, you must use `io2`.
+ Standard file systems, such as XFS and EXT4, are not designed to be accessed simultaneously by multiple servers, such as EC2 instances. You should use a clustered file system to ensure data resiliency and reliability for your production workloads.
+ Multi-Attach enabled `io2` volumes support I/O fencing. I/O fencing protocols control write access in a shared storage environment to maintain data consistency. Your applications must provide write ordering for the attached instances to maintain data consistency. For more information, see [Use NVMe reservations with Multi-Attach enabled Amazon EBS volumes](nvme-reservations.md).

  Multi-Attach enabled `io1` volumes do not support I/O fencing.
+ Multi-Attach enabled volumes can't be created as boot volumes.
+ Multi-Attach enabled volumes can be attached to one block device mapping per instance.
+ Multi-Attach can't be enabled during instance launch using either the Amazon EC2 console or RunInstances API.
+ Multi-Attach enabled volumes that have an issue at the Amazon EBS infrastructure layer are unavailable to all attached instances. Issues at the Amazon EC2 or networking layer might impact only some attached instances.
+ The following table shows volume modification support for Multi-Attach enabled `io1` and `io2` volumes after creation.    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ebs/latest/userguide/ebs-volumes-multi.html)

  \$1 You can't enable or disable Multi-Attach while the volume is attached to an instance.
+ Multi-Attach enabled volumes are deleted on instance termination if the last attached instance is terminated and if that instance is configured to delete the volume on termination. If the volume is attached to multiple instances that have different delete on termination settings in their volume block device mappings, the last attached instance's block device mapping setting determines the delete on termination behavior.

  To ensure predictable delete on termination behavior, enable or disable delete on termination for all of the instances to which the volume is attached. For more information, see [ Preserve data when an instance is terminated](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/preserving-volumes-on-termination.html).
+ You can monitor a Multi-Attach enabled volume using the CloudWatch Metrics for Amazon EBS volumes. Data is aggregated across all of the attached instances. You can't monitor metrics for individual attached instances. For more information, see [Amazon CloudWatch metrics for Amazon EBS](using_cloudwatch_ebs.md).

# Performance for Multi-Attach Amazon EBS volumes
<a name="ebs-multi-attach-perf"></a>

Each attached instance is able to drive its maximum IOPS performance up to the volume's maximum provisioned performance. However, the aggregate performance of all of the attached instances can't exceed the volume's maximum provisioned performance. If the attached instances' demand for IOPS is higher than the volume's Provisioned IOPS, the volume will not exceed its provisioned performance.

For example, say you create an `io2` Multi-Attach enabled volume with `80,000` provisioned IOPS and you attach it to an `m7g.large` instance that supports up to `40,000` IOPS, and an ` r7g.12xlarge` instance that supports up to `60,000` IOPS. Each instance can drive its maximum IOPS as it is less than the volume's Provisioned IOPS of `80,000`. However, if both instances drive I/O to the volume simultaneously, their combined IOPS can't exceed the volume's provisioned performance of `80,000` IOPS. 

To achieve consistent performance, it is best practice to balance I/O driven from attached instances across the sectors of a Multi-Attach enabled volume.

For more information about IOPS performance for the Amazon EC2 instance types, see [ Amazon EBS optimized instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html) in the *Amazon EC2 User Guide*.

# Enable Multi-Attach for an Amazon EBS volume
<a name="working-with-multi-attach"></a>

Multi-Attach enabled volumes can be managed in much the same way that you would manage any other Amazon EBS volume. However, in order to use the Multi-Attach functionality, you must enable it for the volume.

When you create a new volume, Multi-Attach is disabled by default. You can enable Multi-Attach when you create a volume.

You can also enable Multi-Attach for `io2` volumes after creation, but only if they are not attached to any instances. You can't enable Multi-Attach for `io1` volumes after creation.

After you enable Multi-Attach for a volume, you can attach the volume to an instance in the same way that you attach any other EBS volume. For more information, see [Attach an Amazon EBS volume to an Amazon EC2 instance](ebs-attaching-volume.md).

------
#### [ Console ]

**To enable Multi-Attach during volume creation**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**.

1. Choose **Create volume**.

1. For **Volume type**, choose **Provisioned IOPS SSD (`io1`)** or **Provisioned IOPS SSD (`io2`)**.

1. For **Size** and **IOPS**, choose the required volume size and the number of IOPS to provision.

1. For **Availability Zone**, choose the same Availability Zone that the instances are in.

1. For **Amazon EBS Multi-Attach**, choose **Enable Multi-Attach**.

1. (Optional) For **Snapshot ID**, choose the snapshot from which to create the volume.

1. Set the encryption status for the volume.

   If the selected snapshot is encrypted, or if your account is enabled for [encryption by default](encryption-by-default.md), then encryption is automatically enabled and you can't disable it. You can choose the KMS key to use to encrypt the volume.

   If the selected snapshot is unencrypted and your account is not enabled for encryption by default, encryption is optional. To encrypt the volume, for **Encryption**, choose **Encrypt this volume** and then select the KMS key to use to encrypt the volume.

   You can attach encrypted volumes only to instances that support Amazon EBS encryption. For more information, see [Amazon EBS encryption](ebs-encryption.md).

1. (Optional) To assign custom tags to the volume, in the **Tags** section, choose **Add tag**, and then enter a tag key and value pair. 

1. Choose **Create volume**.

**To enable Multi-Attach after creation**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**.

1. Select the volume and choose **Actions**, **Modify volume**.

1. For **Amazon EBS Multi-Attach**, choose **Enable Multi-Attach**.

1. Choose **Modify**.

------
#### [ AWS CLI ]

**To enable Multi-Attach during volume creation**  
Use the [create-volume](https://docs.aws.amazon.com/cli/latest/reference/ec2/create-volume.html) command with the `--multi-attach-enabled` option.

```
aws ec2 create-volume \
    --volume-type io2 \
    --multi-attach-enabled \
    --size 100 \
    --iops 2000 \
    --region us-west-2 \
    --availability-zone us-west-2b
```

**To enable Multi-Attach after creation**  
Use the [modify-volume](https://docs.aws.amazon.com/cli/latest/reference/ec2/modify-volume.html) command with the `--multi-attach-enabled` option.

```
aws ec2 modify-volume \
    --volume-id vol-01234567890abcdef \
    --multi-attach-enabled
```

------
#### [ PowerShell ]

**To enable Multi-Attach during volume creation**  
Use the [New-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/New-EC2Volume.html) cmdlet with the `-MultiAttachEnabled` parameter.

```
New-EC2Volume `
    -VolumeType io2 `
    -MultiAttachEnabled $true `
    -Size 100 `
    -Iops 2000 `
    -Region us-west-2 `
    -AvailabilityZone us-west-2b
```

**To enable Multi-Attach after creation**  
Use the [Edit-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2Volume.html) cmdlet with the `-MultiAttachEnabled` parameter.

```
Edit-EC2Volume `
    -VolumeId vol-01234567890abcdef `
    -MultiAttachEnabled $true
```

------

# Disable Multi-Attach for an Amazon EBS volume
<a name="disable-multi-attach"></a>

You can disable Multi-Attach for an `io2` volume only if it is attached to no more than one instance.

You can't disable Multi-Attach for `io1` volumes after creation.

------
#### [ Console ]

**To disable Multi-Attach after creation**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**.

1. Select the volume and choose **Actions**, **Modify volume**.

1. For **Amazon EBS Multi-Attach**, clear **Enable Multi-Attach**.

1. Choose **Modify**.

------
#### [ AWS CLI ]

**To disable Multi-Attach after creation**  
Use the [modify-volume](https://docs.aws.amazon.com/cli/latest/reference/ec2/modify-volume.html) command with the `-no-multi-attach-enabled` option.

```
aws ec2 modify-volume \
    --volume-id vol-01234567890abcdef \
    --no-multi-attach-enabled
```

------
#### [ PowerShell ]

**To disable Multi-Attach after creation**  
Use the [Edit-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2Volume.html) cmdlet with the `-MultiAttachEnabled` parameter.

```
Edit-EC2Volume `
    -VolumeId vol-01234567890abcdef `
    -MultiAttachEnabled $false
```

------

# Use NVMe reservations with Multi-Attach enabled Amazon EBS volumes
<a name="nvme-reservations"></a>

Multi-Attach enabled `io2` volumes support NVMe reservations, which is a set of industry-standard storage fencing protocols. These protocols enable you to create and manage reservations that control and coordinate access from multiple instances to a shared volume. Reservations are used by shared storage applications to ensure data consistency.

**Topics**
+ [Requirements](#nvme-reservations-reqs)
+ [Enabling support for NVMe reservations](#nvme-reservations-enable)
+ [Supported NVMe Reservation commands](#nvme-reservations-commands)
+ [Pricing](#nvme-reservations-cost)

## Requirements
<a name="nvme-reservations-reqs"></a>

NVMe reservations is supported with Multi-Attach enabled `io2` volumes only. Multi-Attach enabled volumes can be attached only to instances built on the Nitro system.

NVMe reservations is supported with the following operating systems:
+ SUSE Linux Enterprise 12 SP3 and later
+ RHEL 8.3 and later
+ Amazon Linux 2 and later
+ Windows Server 2016 and later

**Note**  
For supported Windows Server AMIs dated 2023.09.13 and later, the required NVMe drivers are included. For earlier AMIs, you must update to NVMe driver version 1.5.0 or later. For more information, see [AWS NVMe drivers](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/aws-nvme-drivers.html).

If you're using EC2Launch v2 to initialize your disks, you must upgrade to version **2.0.1521** or later. For more information, see [Use the EC2Launch v2 agent](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2launch-v2.html).

## Enabling support for NVMe reservations
<a name="nvme-reservations-enable"></a>

Support for NVMe reservations is enabled by default for all Multi-Attach enabled `io2` volumes created after **September 18, 2023**.

To enable support for NVMe reservations for existing `io2` volumes created before September 18, 2023, you must detach all instances from the volume and then reattach the required instances. All attachments made after detaching all of the instances will have NVMe reservations enabled.

## Supported NVMe Reservation commands
<a name="nvme-reservations-commands"></a>

Amazon EBS supports the following NVMe Reservation commands:

**Reservation Register**  
Registers, unregisters, or replaces a reservation key. A registration key is used to identify and authenticate an instance. Registering a reservation key with a volume creates an association between the instance and the volume. You must register the instance with the volume before that instance can acquire a reservation.

**Reservation Acquire**  
Acquires a reservation on a volume, preempts a reservation held on a namespace, and aborts a reservation held on a volume. The following reservation types can be acquired:  
+ Write Exclusive Reservation
+ Exclusive Access Reservation
+ Write Exclusive - Registrants Only Reservation
+ Exclusive Access - Registrants Only Reservation
+ Write Exclusive - All Registrants Reservation
+ Exclusive Access - All Registrants Reservation

**Reservation Release**  
Releases or clears a reservation held on a volume.

**Reservation Report**  
Describes the registration and reservation status of a volume.

## Pricing
<a name="nvme-reservations-cost"></a>

There are no additional costs for enabling and using Multi-Attach.

# Make an Amazon EBS volume available for use
<a name="ebs-using-volumes"></a>

After you attach an Amazon EBS volume to your instance it is exposed as a block device. You can format the volume with any file system and then mount it. After you make the EBS volume available for use, you can access it in the same ways that you access any other volume. Any data written to this file system is written to the EBS volume and is transparent to applications using the device.

You can take snapshots of your EBS volume for backup purposes or to use as a baseline when you create another volume. For more information, see [Amazon EBS snapshots](ebs-snapshots.md).

If the EBS volume you are preparing for use is greater than 2 TiB, you must use a GPT partitioning scheme to access the entire volume. For more information, see [Amazon EBS volume constraints](volume_constraints.md).

## Linux instances
<a name="ebs-use-linux"></a>

### Format and mount an attached volume
<a name="ebs-format-mount-volume"></a>

Suppose that you have an EC2 instance with an EBS volume for the root device, `/dev/xvda`, and that you have just attached an empty EBS volume to the instance using `/dev/sdf`. Use the following procedure to make the newly attached volume available for use.

**To format and mount an EBS volume on Linux**

1. Connect to your instance using SSH. For more information, see [Connect to your Linux instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-to-linux-instance.html).

1. The device could be attached to the instance with a different device name than you specified in the block device mapping. For more information, see [device names on Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html). Use the **lsblk** command to view your available disk devices and their mount points (if applicable) to help you determine the correct device name to use. The output of **lsblk** removes the `/dev/` prefix from full device paths.

   The following is example output for an instance built on the [ Nitro System](https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html), which exposes EBS volumes as NVMe block devices. The root device is `/dev/nvme0n1`, which has two partitions named `nvme0n1p1` and `nvme0n1p128`. The attached volume is `/dev/nvme1n1`, which has no partitions and is not yet mounted.

   ```
   [ec2-user ~]$ lsblk
   NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
   nvme1n1       259:0    0  10G  0 disk
   nvme0n1       259:1    0   8G  0 disk
   -nvme0n1p1    259:2    0   8G  0 part /
   -nvme0n1p128  259:3    0   1M  0 part
   ```

   The following is example output for a T2 instance. The root device is `/dev/xvda`, which has one partition named `xvda1`. The attached volume is `/dev/xvdf`, which has no partitions and is not yet mounted.

   ```
   [ec2-user ~]$ lsblk
   NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
   xvda    202:0    0    8G  0 disk
   -xvda1  202:1    0    8G  0 part /
   xvdf    202:80   0   10G  0 disk
   ```

1. Determine whether there is a file system on the volume. New volumes are raw block devices, and you must create a file system on them before you can mount and use them. Volumes that were created from snapshots likely have a file system on them already; if you create a new file system on top of an existing file system, the operation overwrites your data.

   Use one or both of the following methods to determine whether there is a file system on the volume:
   + Use the **file -s** command to get information about a specific device, such as its file system type. If the output shows simply `data`, as in the following example output, there is no file system on the device

     ```
     [ec2-user ~]$ sudo file -s /dev/xvdf
     /dev/xvdf: data
     ```

     If the device has a file system, the command shows information about the file system type. For example, the following output shows a root device with the XFS file system.

     ```
     [ec2-user ~]$ sudo file -s /dev/xvda1
     /dev/xvda1: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
     ```
   + Use the **lsblk -f** command to get information about all of the devices attached to the instance.

     ```
     [ec2-user ~]$ sudo lsblk -f
     ```

     For example, the following output shows that there are three devices attached to the instances—`nvme1n1`, `nvme0n1`, and `nvme2n1`. The first column lists the devices and their partitions. The `FSTYPE` column shows the file system type for each device. If the column is empty for a specific device, it means that the device does not have a file system. In this case, device `nvme1n1` and partition `nvme0n1p1` on device `nvme0n1` are both formatted using the XFS file system, while device `nvme2n1` and partition `nvme0n1p128` on device `nvme0n1` do not have file systems.

     ```
     NAME		FSTYPE	LABEL	UUID						MOUNTPOINT
     nvme1n1	        xfs		7f939f28-6dcc-4315-8c42-6806080b94dd
     nvme0n1
     ├─nvme0n1p1	xfs	    /	90e29211-2de8-4967-b0fb-16f51a6e464c	        /
     └─nvme0n1p128
     nvme2n1
     ```

   If the output from these commands show that there is no file system on the device, you must create one.

1. <a name="create_file_system_step"></a>(Conditional) If you discovered that there is a file system on the device in the previous step, skip this step. If you have an empty volume, use the **mkfs -t** command to create a file system on the volume.
**Warning**  
Do not use this command if you're mounting a volume that already has data on it (for example, a volume that was created from a snapshot). Otherwise, you'll format the volume and delete the existing data.

   ```
   [ec2-user ~]$ sudo mkfs -t xfs /dev/xvdf
   ```

   If you get an error that `mkfs.xfs` is not found, use the following command to install the XFS tools and then repeat the previous command:

   ```
   [ec2-user ~]$ sudo yum install xfsprogs
   ```

1. Use the **mkdir** command to create a mount point directory for the volume. The mount point is where the volume is located in the file system tree and where you read and write files to after you mount the volume. The following example creates a directory named `/data`.

   ```
   [ec2-user ~]$ sudo mkdir /data
   ```

1. Mount the volume or partition at the mount point directory you created in the previous step.

   If the volume has no partitions, use the following command and specify the device name to mount the entire volume.

   ```
   [ec2-user ~]$ sudo mount /dev/xvdf /data
   ```

   If the volume has partitions, use the following command and specify the partition name to mount a partition.

   ```
   [ec2-user ~]$ sudo mount /dev/xvdf1 /data
   ```

1. Review the file permissions of your new volume mount to make sure that your users and applications can write to the volume. For more information about file permissions, see [File security](https://tldp.org/LDP/intro-linux/html/sect_03_04.html) at *The Linux Documentation Project*.

1. The mount point is not automatically preserved after rebooting your instance. To automatically mount this EBS volume after reboot, follow the next procedure.

### Automatically mount an attached volume after reboot
<a name="ebs-mount-after-reboot"></a>

To mount an attached EBS volume on every system reboot, add an entry for the device to the `/etc/fstab` file.

You can use the device name, such as `/dev/xvdf`, in `/etc/fstab`, but we recommend using the device's 128-bit universally unique identifier (UUID) instead. Device names can change, but the UUID persists throughout the life of the partition. By using the UUID, you reduce the chances that the system becomes unbootable after a hardware reconfiguration. For more information, see [Map Amazon EBS volumes to NVMe device names](identify-nvme-ebs-device.md).

**To mount an attached volume automatically after reboot**

1. (Optional) Create a backup of your `/etc/fstab` file that you can use if you accidentally destroy or delete this file while editing it.

   ```
   [ec2-user ~]$ sudo cp /etc/fstab /etc/fstab.orig
   ```

1. Use the **blkid** command to find the UUID of the device. Make a note of the UUID of the device that you want to mount after reboot. You'll need it in the following step.

   For example, the following command shows that there are two devices mounted to the instance, and it shows the UUIDs for both devices.

   ```
   [ec2-user ~]$ sudo blkid
   /dev/xvda1: LABEL="/" UUID="ca774df7-756d-4261-a3f1-76038323e572" TYPE="xfs" PARTLABEL="Linux" PARTUUID="02dcd367-e87c-4f2e-9a72-a3cf8f299c10"
   /dev/xvdf: UUID="aebf131c-6957-451e-8d34-ec978d9581ae" TYPE="xfs"
   ```

   For Ubuntu 18.04 use the lsblk command.

   ```
   [ec2-user ~]$ sudo lsblk -o +UUID
   ```

1. Open the `/etc/fstab` file using any text editor, such as **nano** or **vim**.

   ```
   [ec2-user ~]$ sudo vim /etc/fstab
   ```

1. Add the following entry to `/etc/fstab` to mount the device at the specified mount point. The fields are the UUID value returned by **blkid** (or **lsblk** for Ubuntu 18.04), the mount point, the file system, and the recommended file system mount options. For more information about the required fields, run `man fstab` to open the **fstab** manual.

   In the following example, we mount the device with UUID `aebf131c-6957-451e-8d34-ec978d9581ae` to mount point `/data` and we use the `xfs` file system. We also use the `defaults` and `nofail` flags. We specify `0` to prevent the file system from being dumped, and we specify `2` to indicate that it is a non-root device.

   ```
   UUID=aebf131c-6957-451e-8d34-ec978d9581ae  /data  xfs  defaults,nofail  0  2
   ```
**Note**  
If you ever boot your instance without this volume attached (for example, after moving the volume to another instance), the `nofail` mount option enables the instance to boot even if there are errors mounting the volume. Debian derivatives, including Ubuntu versions earlier than 16.04, must also add the `nobootwait` mount option.

1. To verify that your entry works, run the following commands to unmount the device and then mount all file systems in `/etc/fstab`. If there are no errors, the `/etc/fstab` file is OK and your file system will mount automatically after it is rebooted.

   ```
   [ec2-user ~]$ sudo umount /data
   [ec2-user ~]$ sudo mount -a
   ```

   If you receive an error message, address the errors in the file.
**Warning**  
Errors in the `/etc/fstab` file can render a system unbootable. Do not shut down a system that has errors in the `/etc/fstab` file.

   If you are unsure how to correct errors in `/etc/fstab` and you created a backup file in the first step of this procedure, you can restore from your backup file using the following command.

   ```
   [ec2-user ~]$ sudo mv /etc/fstab.orig /etc/fstab
   ```

## Windows instances
<a name="ebs-use-win"></a>

Use one of the following methods to make a volume available on a Windows instance.

------
#### [ PowerShell ]

**To make all EBS volumes with raw partitions available to use with Windows PowerShell**

1. Log in to your Windows instance using Remote Desktop. For more information, see [ Connect to your Windows instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connecting_to_windows_instance.html).

1. On the taskbar, open the Start menu, and choose **Windows PowerShell**.

1. Use the provided series of Windows PowerShell commands within the opened PowerShell prompt. The script performs the following actions by default:

   1. Stops the ShellHWDetection service.

   1. Enumerates disks where the partition style is raw.

   1. Creates a new partition that spans the maximum size the disk and partition type will support.

   1. Assigns an available drive letter.

   1. Formats the file system as NTFS with the specified file system label.

   1. Starts the ShellHWDetection service again.

   ```
   Stop-Service -Name ShellHWDetection
   Get-Disk | Where PartitionStyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "Volume Label" -Confirm:$false
   Start-Service -Name ShellHWDetection
   ```

------
#### [ DiskPart command line tool ]

**To make an EBS volume available to use with the DiskPart command line tool**

1. Log in to your Windows instance using Remote Desktop. For more information, see [ Connect to your Windows instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connecting_to_windows_instance.html).

1. Determine the disk number that you want to make available:

   1. Open the Start menu, and select Windows PowerShell.

   1. Use the `Get-Disk` Cmdlet to retrieve a list of available disks.

   1. In the command output, note the **Number** corresponding to the disk that you're making available.

1. Create a script file to execute DiskPart commands:

   1. Open the Start menu, and select **File Explorer**.

   1. Navigate to a directory, such as C:\$1, to store the script file.

   1. Choose or right-click an empty space within the folder to open the dialog box, position the cursor over **New** to access the context menu, and then choose **Text Document**.

   1. Name the text file `diskpart.txt`.

1. Add the following commands to the script file. You may need to modify the disk number, partition type, volume label, and drive letter. The script performs the following actions by default:

   1. Selects disk 1 for modification.

   1. Configures the volume to use the master boot record (MBR) partition structure.

   1. Formats the volume as an NTFS volume.

   1. Sets the volume label.

   1. Assigns the volume a drive letter.
**Warning**  
If you're mounting a volume that already has data on it, do not reformat the volume or you will delete the existing data.

   ```
   select disk 1 
   attributes disk clear readonly 
   online disk noerr
   convert mbr 
   create partition primary 
   format quick fs=ntfs label="volume_label" 
   assign letter="drive_letter"
   ```

   For more information, see [DiskPart Syntax and Parameters](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc766465(v=ws.10)#diskpart-syntax-and-parameters).

1. Open a command prompt, navigate to the folder in which the script is located, and run the following command to make a volume available for use on the specified disk:

   ```
   C:\> diskpart /s diskpart.txt
   ```

------
#### [ Disk Management utility ]

**To make an EBS volume available to use with the Disk Management utility**

1. Log in to your Windows instance using Remote Desktop. For more information, see [ Connect to your Windows instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connecting_to_windows_instance.html).

1. Start the Disk Management utility. On the taskbar, open the context (right-click) menu for the Windows logo, and choose **Disk Management**.
**Note**  
In Windows Server 2008, choose **Start**, **Administrative Tools**, **Computer Management**, **Disk Management**.

1. Bring the volume online. In the lower pane, open the context (right-click) menu for the left panel for the disk for the EBS volume. Choose **Online**.  
![\[Bring the volume online.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/windows-2016-volume-online.png)

1. (Conditional) If the disk is not initialized, you must initialize it before you can use it. If the disk is already initialized, skip this step.
**Warning**  
If you're mounting a volume that already has data on it (for example, a public data set, or a volume that you created from a snapshot), do not reformat the volume or you will delete the existing data.

   If the disk is not initialized, initialize it as follows:

   1. Open the context (right-click) menu for the left panel for the disk, and choose **Initialize Disk**.  
![\[Initialize the volume.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/windows-2016-volume-initialize.png)

   1. In the **Initialize Disk** dialog box, select a partition style, and choose **OK**.  
![\[Initialize volume settings.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/windows-2016-volume-initialize-settings.png)

1. Open the context (right-click) menu for the right panel for the disk, and choose **New Simple Volume**.  
![\[Mount a simple volume.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/windows-2016-new-simple-volume.png)

1. In the **New Simple Volume Wizard**, choose **Next**.  
![\[Begin the New Simple Volume Wizard.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/windows-2016-new-simple-volume-wizard-welcome.png)

1. If you want to change the default maximum value, specify the **Simple volume size in MB**, and then choose **Next.**  
![\[Specify the volume size.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/windows-2016-new-simple-volume-wizard-size.png)

1. Specify a preferred drive letter, if necessary, within the **Assign the following drive letter** dropdown, and then choose **Next.**  
![\[Specify a drive letter.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/windows-2016-new-simple-volume-wizard-letter.png)

1. Specify a **Volume Label** and adjust the default settings as necessary, and then choose **Next.**  
![\[Specify settings to format the volume.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/windows-2016-new-simple-volume-wizard-format.png)

1. Review your settings, and then choose **Finish** to apply the modifications and close the New Simple Volume wizard.  
![\[Review your settings and finish the wizard.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/windows-2016-new-simple-volume-wizard-finish.png)

------

# View information about an Amazon EBS volume
<a name="ebs-describing-volumes"></a>

You can view descriptive information about your EBS volumes. For example, you can view information about all volumes in a specific Region or view detailed information about a single volume, including its size, volume type, whether the volume is encrypted, which KMS key was used to encrypt the volume, and the specific instance to which the volume is attached.

You can get additional information about your EBS volumes, such as how much disk space is available, from the operating system on the instance.

**Topics**
+ [View volume information](#ebs-view-information-console)
+ [Volume states](#volume-state)
+ [View volume metrics](#ebs-view-volume-metrics)
+ [View free disk space](#ebs-view-free-disk-space-lin)

## View volume information
<a name="ebs-view-information-console"></a>

You can view information about your EBS volumes.

------
#### [ Console ]

**To view information about a volume**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**. 

1. To reduce the list, you can filter your volumes using tags and volume attributes. Choose the filter field, select a tag or volume attribute, and then select the filter value.

1. To view more information about a volume, choose its ID.

**To view the EBS volumes that are attached to an instance**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Instances**.

1. Select the instance.

1. On the **Storage** tab, the **Block devices** section lists the volumes that are attached to the instance. To view information about a specific volume, choose its ID in the **Volume ID** column.

------
#### [ Amazon EC2 Global View ]

You can use [Amazon EC2 Global View](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/global-view.html) to view your volumes across all Regions for which your AWS account is enabled.

**To get a summary of your EBS volumes across all Regions**

1. Open the Amazon EC2 Global View console at [https://console.aws.amazon.com/ec2globalview/home](https://console.aws.amazon.com/ec2globalview/home).

1. On the **Region explorer** tab, under **Summary**, check the resource count for **Volumes**, which includes the number of volumes and the number of Regions. Click the underlined text to see how the volume count is spread across Regions.

1. On the **Global search** tab, select the client filter **Resource type = Volume**. You can filter the results further by specifying a Region or a tag.

------
#### [ AWS CLI ]

**To view information about an EBS volume**  
Use the [describe-volumes](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volumes.html) command. The following example counts the volumes in the current Region.

```
aws ec2 describe-volumes --query "length(Volumes[*])"
```

The following example lists the volumes attached to the specified instance.

```
aws ec2 describe-volumes \
    --filters "Name=attachment.instance-id,Values=i-1234567890abcdef0" \
    --query Volumes[*].VolumeId \
    --output text
```

The following example describes the specified volume.

```
aws ec2 describe-volumes --volume-ids vol-01234567890abcdef
```

The following is example output.

```
{
    "Volumes": [
        {
            "Iops": 3000,
            "VolumeType": "gp3",
            "MultiAttachEnabled": false,
            "Throughput": 125,
            "Operator": {
                "Managed": false
            },
            "VolumeId": "vol-01234567890abcdef",
            "Size": 8,
            "SnapshotId": "snap-0abcdef1234567890",
            "AvailabilityZone": "us-west-2b",
            "State": "in-use",
            "CreateTime": "2024-05-17T23:23:00.400000+00:00",
            "Attachments": [
                {
                    "DeleteOnTermination": true,
                    "VolumeId": "vol-01234567890abcdef",
                    "InstanceId": "i-1234567890abcdef0",
                    "Device": "/dev/xvda",
                    "State": "attached",
                    "AttachTime": "2024-05-17T23:23:00+00:00"
                }
            ],
            "Encrypted": false
        }
    ]
}
```

------
#### [ PowerShell ]

**To view information about an EBS volume**  
Use the [Get-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Volume.html) cmdlet. The following example counts the volumes in the current Region.

```
(Get-EC2Volume).Count
```

The following example lists the volumes attached to the specified instance.

```
(Get-EC2Volume `
    -Filters @{Name="attachment.instance-id";Values="i-1234567890abcdef0"}).VolumeId
```

The following example describes the specified volume.

```
Get-EC2Volume -VolumeId vol-01234567890abcdef
```

The following is example output.

```
Attachments        : {i-1234567890abcdef0}
AvailabilityZone   : us-west-2b
CreateTime         : 5/17/2024 11:23:00 PM
Encrypted          : False
FastRestored       : False
Iops               : 3000
KmsKeyId           : 
MultiAttachEnabled : False
Operator           : Amazon.EC2.Model.OperatorResponse
OutpostArn         : 
Size               : 8
SnapshotId         : snap-0abcdef1234567890
SseType            : 
State              : in-use
Tags               : {}
Throughput         : 125
VolumeId           : vol-01234567890abcdef
VolumeType         : gp3
```

------

## Volume states
<a name="volume-state"></a>

Volume state describes the availability of an Amazon EBS volume. You can view the volume state in the **State** column on the **Volumes** page in the console, or by using the [describe-volumes](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volumes.html) AWS CLI command.

An Amazon EBS volume transitions through different states from the moment it is created until it is deleted.

The following illustration shows the transitions between volume states. You can create a volume from an Amazon EBS snapshot or create an empty volume. When you create a volume, it enters the `creating` state. After the volume is ready for use, it enters the `available` state. You can attach an available volume to an instance in the same Availability Zone as the volume. You must detach the volume before you can attach it to a different instance or delete it. You can delete a volume when you no longer need it.

![\[The lifecycle of an EBS volume.\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/volume-states.png)


The following table summarizes the volume states.


| State | Description | 
| --- | --- | 
| creating | The volume is being created. | 
| available | The volume is not attached to an instance. | 
| in-use | The volume is attached to an instance. | 
| deleting | The volume is being deleted. | 
| deleted | The volume is deleted. | 
| error | The underlying hardware related to your EBS volume has failed, and the data associated with the volume is unrecoverable. For information about how to restore the volume or recover the data on the volume, see [Why does my EBS volume have a status of "error"?](https://repost.aws/knowledge-center/ebs-error-status). | 

## View volume metrics
<a name="ebs-view-volume-metrics"></a>

You can get additional information about your EBS volumes from Amazon CloudWatch. For more information, see [Amazon CloudWatch metrics for Amazon EBS](using_cloudwatch_ebs.md).

## View free disk space
<a name="ebs-view-free-disk-space-lin"></a>

You can get additional information about your EBS volumes, such as how much disk space is available, from the operating system on the instance.

### Linux instances
<a name="ebs-view-free-disk-space-linux"></a>

Use the **df -hT** command and specify the device name:

```
[ec2-user ~]$ df -hT /dev/xvda1
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/xvda1     xfs       8.0G  1.2G  6.9G  15% /
```

### Windows instances
<a name="ebs-view-free-disk-space-windows"></a>

You can view the free disk space by opening File Explorer and selecting **This PC**.

You can also view the free disk space using the following `dir` command and examining the last line of the output:

```
C:\> dir C:
 Volume in drive C has no label.
 Volume Serial Number is 68C3-8081

 Directory of C:\

03/25/2018  02:10 AM    <DIR>          .
03/25/2018  02:10 AM    <DIR>          ..
03/25/2018  03:47 AM    <DIR>          Contacts
03/25/2018  03:47 AM    <DIR>          Desktop
03/25/2018  03:47 AM    <DIR>          Documents
03/25/2018  03:47 AM    <DIR>          Downloads
03/25/2018  03:47 AM    <DIR>          Favorites
03/25/2018  03:47 AM    <DIR>          Links
03/25/2018  03:47 AM    <DIR>          Music
03/25/2018  03:47 AM    <DIR>          Pictures
03/25/2018  03:47 AM    <DIR>          Saved Games
03/25/2018  03:47 AM    <DIR>          Searches
03/25/2018  03:47 AM    <DIR>          Videos
               0 File(s)              0 bytes
              13 Dir(s)  18,113,662,976 bytes free
```

You can also view the free disk space using the following `fsutil` command:

```
C:\> fsutil volume diskfree C:
Total # of free bytes        : 18113204224
Total # of bytes             : 32210153472
Total # of avail free bytes  : 18113204224
```

**Tip**  
You can also use the CloudWatch agent to collect disk space usage metrics from an Amazon EC2 instance without connecting to the instance. For more information, see [ Create the CloudWatch agent configuration file](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/create-cloudwatch-agent-configuration-file.html) and [Installing the CloudWatch agent](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-on-EC2-Instance.html) in the *Amazon CloudWatch User Guide*. If you need to monitor disk space usage for multiple instances, you can install and configure the CloudWatch agent on those instances using Systems Manager. For more information, see [ Installing the CloudWatch agent using Systems Manager](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/installing-cloudwatch-agent-ssm.html).

# Modify an Amazon EBS volume using Elastic Volumes operations
<a name="ebs-modify-volume"></a>

With Amazon EBS Elastic Volumes, you can increase the volume size, change the volume type, or adjust the performance of your EBS volumes. If your instance supports Elastic Volumes, you can do so without detaching the volume or restarting the instance. This enables you to continue using your application while the changes take effect.

There is no charge to modify the configuration of a volume. You are charged for the new volume configuration after volume modification starts. For more information, see the [Amazon EBS Pricing](https://aws.amazon.com/ebs/pricing/) page.

**Topics**
+ [Considerations](#elastic-volumes-considerations)
+ [Limitations](#elastic-volumes-limitations)
+ [Requirements for Amazon EBS volume modifications](modify-volume-requirements.md)
+ [Request Amazon EBS volume modifications](requesting-ebs-volume-modifications.md)
+ [Monitor the progress of Amazon EBS volume modifications](monitoring-volume-modifications.md)
+ [Extend the file system after resizing an Amazon EBS volume](recognize-expanded-volume-linux.md)

## Considerations
<a name="elastic-volumes-considerations"></a>
+ After you initiate a volume modification, you must wait for that modification to reach the `completed` state before you can initiate another modification for the same volume. You can modify a volume up to four times within a rolling 24-hour period, as long as the volume is in the `in-use` or `available` state, and all previous modifications for that volume are `completed`. If you exceed this limit, you get an error message that indicates when you can perform your next modification.
+ Volume modifications are performed on a best-effort basis, and they can take from a few minutes to a few hours to complete, depending on the requested volume configuration. Typically, A 1-TiB volume can take up to six hours to be modified. However, the time does not always scale linearly with the volume size - a larger volume might take less time, and a smaller volume might take more time.
+ Size increases take effect once the volume modification reaches the `optimizing` state, which usually takes a few seconds.
+ Modification time is increased for volumes that are not fully initialized. For more information see [Manually initialize the volumes after creation](initalize-volume.md#ebs-initialize).
+ If you change the volume type from `gp2` to `gp3`, and you do not specify IOPS or throughput performance, Amazon EBS automatically provisions either equivalent performance to that of the source `gp2` volume, or the baseline `gp3` performance, whichever is higher.

  For example, if you modify a 500 GiB `gp2` volume with 250 MiB/s throughput and 1500 IOPS to `gp3` without specifying IOPS or throughput performance, Amazon EBS automatically provisions the `gp3` volume with 3000 IOPS (baseline `gp3` IOPS) and 250 MiB/s (to match the source `gp2` volume throughput).
+ If you encounter an error message while attempting to modify an EBS volume, or if you are modifying an EBS volume attached to a previous-generation instance type, take one of the following steps:
  + For a non-root volume, detach the volume from the instance, apply the modifications, and then re-attach the volume.
  + For a root volume, stop the instance, apply the modifications, and then restart the instance.

## Limitations
<a name="elastic-volumes-limitations"></a>
+ You can't cancel a volume modification request after it has been submitted.
+ You must increase the volume size. You can't decrease the volume size. However, you can create a smaller volume and then migrate your data to it using an application-level tool such as **rsync** (Linux instances) or **robocopy** (Windows instances).
+ There are limits to the maximum aggregated storage that can be requested across volume modifications. For more information, see [Amazon EBS service quotas](https://docs.aws.amazon.com/general/latest/gr/ebs-service.html#limits_ebs) in the *Amazon Web Services General Reference*.
+ The new volume size can't exceed the supported capacity of its file system and partitioning scheme. For more information, see [Amazon EBS volume constraints](volume_constraints.md).
+ If you are not changing the volume type, then volume size and performance modifications must be within the limits of the current volume type. If you are changing the volume type, then volume size and performance modifications must be within the limits of the target volume type. For more information, see [Amazon EBS volume types](ebs-volume-types.md)
+ [ Nitro-based instances](https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html) support volumes provisioned with up to 256,000 IOPS. Other instance types can be attached to volumes provisioned with up to 64,000 IOPS, but can achieve up to 32,000 IOPS.
+ You can't modify the volume type for Multi-Attach enabled `io2` volumes.
+ You can't modify the volume type, size, or Provisioned IOPS of Multi-Attach enabled `io1` volumes.
+ A root volume of type `io1`, `io2`, `gp2`, `gp3`, or `standard` can't be modified to an `st1` or `sc1` volume, even if it is detached from the instance.
+ If the volume was attached before November 3, 2016 23:40 UTC, you must initialize Elastic Volumes support. For more information, see [Initializing Elastic Volumes Support](requesting-ebs-volume-modifications.md#initialize-modification-support).
+ While `m3.medium` instances fully support volume modification, `m3.large`, `m3.xlarge`, and `m3.2xlarge` instances might not support all volume modification features.

# Requirements for Amazon EBS volume modifications
<a name="modify-volume-requirements"></a>

The following requirements and limitations apply when you modify an Amazon EBS volume. To learn more about the general requirements for EBS volumes, see [Amazon EBS volume constraints](volume_constraints.md).

**Topics**
+ [Supported instance types](#instance-support)
+ [Operating system](#operating-system)

## Supported instance types
<a name="instance-support"></a>

Elastic Volumes are supported on the following instances:
+ All [current generation instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#current-gen-instances)
+ The following previous-generation instances: C1, C3, C4, G2, I2, M1, M3, M4, R3, and R4

If your instance type does not support Elastic Volumes, see [Modify an EBS volume if Elastic Volumes is not supported](requesting-ebs-volume-modifications.md#modify-volume-stop-start).

## Operating system
<a name="operating-system"></a>

The following operating system requirements apply:

### Linux
<a name="operating-system-linux"></a>

Linux AMIs require a GUID partition table (GPT) and GRUB 2 for boot volumes that are 2 TiB (2,048 GiB) or larger. Many Linux AMIs today still use the MBR partitioning scheme, which only supports boot volume sizes up to 2 TiB. If your instance does not boot with a boot volume larger than 2 TiB, the AMI you are using may be limited to a boot volume size of less than 2 TiB. Non-boot volumes do not have this limitation on Linux instances.

Before attempting to resize a boot volume beyond 2 TiB, you can determine whether the volume is using MBR or GPT partitioning by running the following command on your instance:

```
[ec2-user ~]$ sudo gdisk -l /dev/xvda
```

An Amazon Linux instance with GPT partitioning returns the following information:

```
GPT fdisk (gdisk) version 0.8.10
  
  Partition table scan:
    MBR: protective
    BSD: not present
    APM: not present
    GPT: present
  
  Found valid GPT with protective MBR; using GPT.
```

A SUSE instance with MBR partitioning returns the following information:

```
GPT fdisk (gdisk) version 0.8.8
  
  Partition table scan:
    MBR: MBR only
    BSD: not present
    APM: not present
    GPT: not present
```

### Windows
<a name="operating-system-windows"></a>

By default, Windows initializes volumes with a Master Boot Record (MBR) partition table. Because MBR supports only volumes smaller than 2 TiB (2,048 GiB), Windows prevents you from resizing MBR volumes beyond this limit. In such a case, the **Extend Volume** option is disabled in the Windows **Disk Management** utility. If you use the AWS Management Console or AWS CLI to create an MBR-partitioned volume that exceeds the size limit, Windows cannot detect or use the additional space.

To overcome this limitation, you can create a new, larger volume with a GUID partition table (GPT) and copy over the data from the original MBR volume. 

**To create a GPT volume**

1. Create a new, empty volume of the desired size in the Availability Zone of the EC2 instance and attach it to your instance. 
**Note**  
The new volume must not be a volume restored from a snapshot.

1. Log in to your Windows system and open **Disk Management** (**diskmgmt.exe**). 

1. Open the context (right-click) menu for the new disk and choose **Online**.

1. In the **Initialize Disk** window, select the new disk and choose **GPT (GUID Partition Table)**, **OK**.

1. When initialization is complete, copy the data from the original volume to the new volume, using a tool such as robocopy or teracopy.

1. In **Disk Management**, change the drive letters to appropriate values and take the old volume offline.

1. In the Amazon EC2 console, detach the old volume from the instance, reboot the instance to verify that it functions properly, and delete the old volume.

# Request Amazon EBS volume modifications
<a name="requesting-ebs-volume-modifications"></a>

With Elastic Volumes, you can dynamically increase the size, increase or decrease the performance, and change the volume type of your Amazon EBS volumes without detaching them.

**Process overview**

1. (Optional) Before modifying a volume that contains valuable data, it is a best practice to create a snapshot of the volume in case you need to roll back your changes. For more information, see [Create Amazon EBS snapshots](ebs-creating-snapshot.md).

1. Request the volume modification.

1. Monitor the progress of the volume modification. For more information, see [Monitor the progress of Amazon EBS volume modifications](monitoring-volume-modifications.md).

1. If the size of the volume was modified, extend the volume's file system to take advantage of the increased storage capacity. For more information, see [Extend the file system after resizing an Amazon EBS volume](recognize-expanded-volume-linux.md).

**Topics**
+ [Modify an EBS volume using Elastic Volumes](#modify-ebs-volume)
+ [Modify an EBS volume if Elastic Volumes is not supported](#modify-volume-stop-start)
+ [Initialize Elastic Volumes support (if needed)](#initialize-modification-support)

## Modify an EBS volume using Elastic Volumes
<a name="modify-ebs-volume"></a>

Before you begin, see the following:
+ [Considerations](ebs-modify-volume.md#elastic-volumes-considerations)
+ [Limitations](ebs-modify-volume.md#elastic-volumes-limitations)
+ [Requirements](modify-volume-requirements.md)

------
#### [ Console ]<a name="console-modify-size"></a>

**To modify an EBS volume**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**.

1. Select the volume to modify and choose **Actions**, **Modify volume**.

1. The **Modify volume** screen displays the volume ID and the volume's current configuration, including type, size, IOPS, and throughput. Set new configuration values as follows:
   + To modify the type, choose a value for **Volume type**.
   + To modify the size, enter a new value for **Size**.
   + (`gp3`, `io1`, and `io2` only) To modify the IOPS, enter a new value for **IOPS**.
   + (`gp3` only) To modify the throughput, enter a new value for **Throughput**.

1. After you have finished changing the volume settings, choose **Modify**. When prompted for confirmation, choose **Modify**.

1. If you've increased the size of your volume, then you must also extend the volume's partition to make use of the additional storage capacity. For more information, see [Extend the file system after resizing an Amazon EBS volume](recognize-expanded-volume-linux.md).

1. (*Windows instances only*) If you increase the size of an NVMe volume on an instance that does not have the AWS NVMe drivers, you must reboot the instance to enable Windows to see the new volume size. For more information about installing the AWS NVMe drivers, see [AWS NVMe drivers](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/aws-nvme-drivers.html).

------
#### [ AWS CLI ]

**To modify an EBS volume**  
Use the [modify-volume](https://docs.aws.amazon.com/cli/latest/reference/ec2/modify-volume.html) command. For example, if you have a volume of type `gp2` with a size of 100 GiB, the following example changes its configuration to a volume of type `io1` with 10,000 IOPS and a size of 200 GiB.

```
aws ec2 modify-volume \
    --volume-id vol-01234567890abcdef \
    --volume-type io1 \
    --iops 10000 \
    --size 200
```

The following is example output.

```
{
    "VolumeModification": {
        "TargetSize": 200,
        "TargetVolumeType": "io1",
        "ModificationState": "modifying",
        "VolumeId": "vol-01234567890abcdef",
        "TargetIops": 10000,
        "StartTime": "2022-01-19T22:21:02.959Z",
        "Progress": 0,
        "OriginalVolumeType": "gp2",
        "OriginalIops": 300,
        "OriginalSize": 100
    }
}
```

If you've increased the size of your volume, then you must also extend the volume's partition to make use of the additional storage capacity. For more information, see [Extend the file system after resizing an Amazon EBS volume](recognize-expanded-volume-linux.md).

------
#### [ PowerShell ]

**To modify an EBS volume**  
Use the [Edit-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/Edit-EC2Volume.html) cmdlet. For example, if you have a volume of type `gp2` with a size of 100 GiB, the following example changes its configuration to a volume of type `io1` with 10,000 IOPS and a size of 200 GiB.

```
Edit-EC2Volume `
    -VolumeId vol-01234567890abcdef `
    -VolumeType io1 `
    -Iops 10000 `
    -Size 200
```

If you've increased the size of your volume, then you must also extend the volume's partition to make use of the additional storage capacity. For more information, see [Extend the file system after resizing an Amazon EBS volume](recognize-expanded-volume-linux.md).

------

## Modify an EBS volume if Elastic Volumes is not supported
<a name="modify-volume-stop-start"></a>

If you are using a supported instance type, you can use Elastic Volumes to dynamically modify the size, performance, and volume type of your Amazon EBS volumes without detaching them.

If you cannot use Elastic Volumes but you need to modify the root (boot) volume, you must stop the instance, modify the volume, and then restart the instance.

After the instance has started, you can check the file system size to see if your instance recognizes the larger volume space. On Linux, use the **df -h** command to check the file system size.

```
[ec2-user ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            7.9G  943M  6.9G  12% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
```

If the size does not reflect your newly expanded volume, you must extend the file system of your device so that your instance can use the new space. For more information, see [Extend the file system after resizing an Amazon EBS volume](recognize-expanded-volume-linux.md).

With Windows instances, you might have to bring the volume online in order to use it. For more information, see [Make an Amazon EBS volume available for use](ebs-using-volumes.md). You do not need to reformat the volume.

## Initialize Elastic Volumes support (if needed)
<a name="initialize-modification-support"></a>

Before you can modify a volume that was attached to an instance before November 3, 2016 23:40 UTC, you must initialize volume modification support using one of the following actions:
+ Detach and attach the volume
+ Stop and start the instance

------
#### [ Console ]

**To determine whether your instances are ready**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. On the navigation pane, choose **Instances**.

1. Choose the **Show/Hide Columns** icon (the gear). Select the **Launch time** attribute column and then choose **Confirm**.

1. Sort the list of instances by the **Launch Time** column. For each instance that was started before the cutoff date, choose the **Storage** tab and check the **Attachment time** column to see when its volumes were attached.

------
#### [ AWS CLI ]

**To determine whether your instances are ready**  
Use the following [describe-instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html) command to determine whether the volume was attached before November 3, 2016 23:40 UTC.

```
aws ec2 describe-instances \
    --query "Reservations[*].Instances[*].[InstanceId,LaunchTime<='2016-11-01',BlockDeviceMappings[*][Ebs.AttachTime<='2016-11-01']]" \
    --output text
```

The first line of the output for each instance shows its ID and whether it was started before the cutoff date (True or False). The first line is followed by one or more lines that show whether each EBS volume was attached before the cutoff date (True or False). In the following example output, you must initialize volume modification for the first instance because it was started before the cutoff date and its root volume was attached before the cutoff date. The other instances are ready because they were started after the cutoff date.

```
i-e905622e              True
True
i-719f99a8              False
True
i-006b02c1b78381e57     False
False
False
i-e3d172ed              False
True
```

------
#### [ PowerShell ]

**To determine whether an instance is ready**  
Use the [Get-EC2Instance](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Instance.html) cmdlet to determine whether a volume was attached before November 3, 2016 23:40 UTC.

```
(Get-EC2Instance `
    -InstanceId i-1234567890abcdef0).Instances.BlockDeviceMappings | `
     Format-Table @{Name="VolumeId";Expression={$_.Ebs.VolumeId}}, `
                  @{Name="AttachTime";Expression={$_.Ebs.AttachTime}}
```

The following is example output.

```
VolumeId              AttachTime
--------              ----------
vol-0b243c8d927752d2b 3/23/2020 12:21:14 AM
vol-043eadbeb4a8387c3 9/5/2020 7:39:22 PM
vol-0c3f0c4e55c082753 4/23/2019 4:07:40 PM
```

------

# Monitor the progress of Amazon EBS volume modifications
<a name="monitoring-volume-modifications"></a>

When you modify an EBS volume, it goes through a sequence of states. The volume enters the `modifying` state, the `optimizing` state, and finally the `completed` state. At this point, the volume is ready to be further modified. 

While the volume is in the `optimizing` state, your volume performance is in between the source and target configuration specifications. Transitional volume performance will be no less than the source volume performance. If you are downgrading IOPS, transitional volume performance is no less than the target volume performance.

Volume modification changes take effect as follows:
+ Size increases take effect once the volume modification reaches the `optimizing` state, which usually takes a few seconds.
+ Performance (IOPS and throughput) changes can take from a few minutes to a few hours to complete, depending on the requested volume configuration. Typically, a fully used 1-TiB volume can take about 6 hours to migrate to a new performance configuration. In some cases, it can take more than 24 hours for a new performance configuration to take effect, such as when the volume has not been fully initialized.

The possible volume states are `creating`, `available`, `in-use`, `deleting`, `deleted`, and `error`.

The possible modification states are `modifying`, `optimizing`, and `completed`.

------
#### [ Console ]

**To monitor progress of a modification**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**.

1. Select the volume.

1. The **Volume state** column and the **Volume state** field in the **Details** tab contain information in the following format: *Volume state* - *Modification state* (*Modification progress*%). The following image shows the volume and volume modification states.  
![\[Volume and volume modification states\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/volume_state.png)

   After the modification completes, only the volume state is displayed. The modification state and progress are no longer displayed.

   Alternatively, you can use Amazon EventBridge to create a notification rule for volume modification events. For more information, see [Getting started with Amazon EventBridge](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-get-started.html).

------
#### [ AWS CLI ]

**To monitor progress of a modification**  
Use the [describe-volumes-modifications](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volumes-modifications.html) command to view the progress of one or more volume modifications. The following example describes the volume modifications for two volumes.

```
aws ec2 describe-volumes-modifications \
    --volume-ids vol-11111111111111111 vol-22222222222222222
```

In the following example output, the volume modifications are still in the `modifying` state. Progress is reported as a percentage.

```
{
    "VolumesModifications": [
        {
            "TargetSize": 200,
            "TargetVolumeType": "io1",
            "ModificationState": "modifying",
            "VolumeId": "vol-11111111111111111",
            "TargetIops": 10000,
            "StartTime": "2017-01-19T22:21:02.959Z",
            "Progress": 0,
            "OriginalVolumeType": "gp2",
            "OriginalIops": 300,
            "OriginalSize": 100
        },
        {
            "TargetSize": 2000,
            "TargetVolumeType": "sc1",
            "ModificationState": "modifying",
            "VolumeId": "vol-22222222222222222",
            "StartTime": "2017-01-19T22:23:22.158Z",
            "Progress": 0,
            "OriginalVolumeType": "gp2",
            "OriginalIops": 300,
            "OriginalSize": 1000
        }
    ]
}
```

The next example describes all volumes with a modification state of either `optimizing` or `completed`, and then filters and formats the results to show only modifications that were initiated on or after February 1, 2017:

```
aws ec2 describe-volumes-modifications \
    --filters Name=modification-state,Values="optimizing","completed" \
    --query "VolumesModifications[?StartTime>='2017-02-01'].{ID:VolumeId,STATE:ModificationState}"
```

The following is example output with information about two volumes:

```
[
    {
        "STATE": "optimizing",
        "ID": "vol-06397e7a0eEXAMPLE"
    },
    {
        "STATE": "completed",
        "ID": "vol-ba74e18c2aEXAMPLE"
    }
]
```

------
#### [ PowerShell ]

**To monitor progress of a modification**  
Use the [Get-EC2VolumeModification](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2VolumeModification.html) cmdlet. The following example describes the volume modifications for two volumes.

```
Get-EC2VolumeModification `
    -VolumeId vol-11111111111111111 vol-22222222222222222
```

------

**Note**  
Rarely, a transient AWS fault can result in a `failed` state. This is not an indication of volume health; it merely indicates that the modification to the volume failed. If this occurs, retry the volume modification.

# Extend the file system after resizing an Amazon EBS volume
<a name="recognize-expanded-volume-linux"></a>

After you [increase the size of an EBS volume](requesting-ebs-volume-modifications.md), you must extend the partition and file system to the new, larger size. You can do this as soon as the volume enters the `optimizing` state.

## Before you begin
<a name="extend-file-system"></a>
+ Create a snapshot of the volume, in case you need to roll back your changes. For more information, see [Create Amazon EBS snapshots](ebs-creating-snapshot.md).
+ Confirm that the volume modification succeeded and that it is in the`optimizing` or `completed` state. For more information, see [Monitor the progress of Amazon EBS volume modifications](monitoring-volume-modifications.md).
+ Ensure that the volume is attached to the instance and that it is formatted and mounted. For more information, see [Format and mount an attached volume](ebs-using-volumes.md#ebs-format-mount-volume).
+ (*Linux instances only*) If you are using logical volumes on the Amazon EBS volume, you must use Logical Volume Manager (LVM) to extend the logical volume. For instructions about how to do this, see the **Extend the LV** section in the article [ How do I use LVM to create a logical volume on an EBS volume's partition?](https://repost.aws/knowledge-center/create-lv-on-ebs-partition).

## Linux instances
<a name="extend-linux"></a>

**Note**  
The following instructions walk you through the process of extending **XFS** and **Ext4** file systems for Linux. For information about extending a different file system, see its documentation.

Before you can extend a file system on Linux, you must extend the partition, if your volume has one.

### Extend the file system of EBS volumes
<a name="extend-file-system"></a>

Use the following procedure to extend the file system for a resized volume.

Note that device and partition naming differs for Xen instances and instances built on the Nitro System. To determine whether your instance is Xen-based or Nitro-based, see [ Amazon EC2 hypervisor type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#instance-hypervisor-type).

**To extend the file system of EBS volumes**

1. [Connect to your instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-to-linux-instance.html).

1. Resize the partition, if needed. To do so:

   1. Check whether the volume has a partition. Use the **lsblk** command.

------
#### [ Nitro instance example ]

      In the following example output, the root volume (`nvme0n1`) has two partitions (`nvme0n1p1` and `nvme0n1p128`), while the additional volume (`nvme1n1`) has no partitions.

      ```
      [ec2-user ~]$ sudo lsblk
      NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      nvme1n1       259:0    0  30G  0 disk /data
      nvme0n1       259:1    0  16G  0 disk
      └─nvme0n1p1   259:2    0   8G  0 part /
      └─nvme0n1p128 259:3    0   1M  0 part
      ```

------
#### [ Xen instance example ]

      In the following example output, the root volume (`xvda`) has a partition (`xvda1`), while the additional volume (`xvdf`) has no partition.

      ```
      [ec2-user ~]$ sudo lsblk                
      NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      xvda    202:0    0  16G  0 disk
      └─xvda1 202:1    0   8G  0 part /
      xvdf    202:80   0  24G  0 disk
      ```

------
      + If the volume has a partition, continue to the next step (2b).
      + If the volume has no partitions, skip steps 2b, 2c, and 2d, and continue to step 3.
**Troubleshooting tip**  
If you do not see the volume in the command output, ensure that the volume is [attached to the instance](ebs-attaching-volume.md), and that it is [formatted and mounted](ebs-using-volumes.md#ebs-format-mount-volume).

   1. Check whether the partition needs to be extended. In the **lsblk** command output from the previous step, compare the partition size and the volume size.
      + If the partition size is smaller than the volume size, continue to the next step (2c).
      + If the partition size is equal to the volume size, the partition does not need to be extended - skip steps 2c and 2d, and continue to step 3.
**Troubleshooting tip**  
If the volume still reflects the original size, [ confirm that the volume modification succeeded](monitoring-volume-modifications.md).

   1. Extend the partition. Use the **growpart** command and specify the device name and the partition number.

------
#### [ Nitro instance example ]

      The partition number is the number after the `p`. For example, for `nvme0n1p1`, the partition number is `1`. For `nvme0n1p128`, the partition number is `128`.

      To extend a partition named `nvme0n1p1`, use the following command.

**Important**  
Note the space between the device name (`nvme0n1`) and the partition number (`1`).

      ```
      [ec2-user ~]$ sudo growpart /dev/nvme0n1 1
      ```

------
#### [ Xen instance example ]

      The partition number is the number after the device name. For example, for `xvda1`, the partition number is `1`. For `xvda128`, the partition number is `128`.

      To extend a partition named `xvda1`, use the following command.

**Important**  
Note the space between the device name (`xvda`) and the partition number (`1`).

      ```
      [ec2-user ~]$ sudo growpart /dev/xvda 1
      ```

------
**Troubleshooting tips**  
`mkdir: cannot create directory ‘/tmp/growpart.31171’: No space left on device FAILED: failed to make temp dir`: Indicates that there is not enough free disk space on the volume for growpart to create the temporary directory it needs to perform the resize. Free up some disk space and then try again.
`must supply partition-number`: Indicates that you specified an incorrect partition. Use the **lsblk** command to confirm the partition name, and ensure that you enter a space between the device name and the partition number.
`NOCHANGE: partition 1 is size 16773087. it cannot be grown`: Indicates that the partition already extends the entire volume and can't be extended. [Confirm that the volume modification succeeded](monitoring-volume-modifications.md).

   1. Verify that the partition has been extended. Use the **lsblk** command. The partition size should now be equal to the volume size.

------
#### [ Nitro instance example ]

      The following example output shows that both the volume (`nvme0n1`) and the partition (`nvme0n1p1`) are the same size (`16 GB`).

      ```
      [ec2-user ~]$ sudo lsblk
      NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      nvme1n1       259:0    0  30G  0 disk /data
      nvme0n1       259:1    0  16G  0 disk
      └─nvme0n1p1   259:2    0  16G  0 part /
      └─nvme0n1p128 259:3    0   1M  0 part
      ```

------
#### [ Xen instance example ]

      The following example output shows that both the volume (`xvda`) and the partition (`xvda1`) are the same size (`16 GB`).

      ```
      [ec2-user ~]$ sudo lsblk               
      NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      xvda    202:0    0  16G  0 disk
      └─xvda1 202:1    0  16G  0 part /
      xvdf    202:80   0  24G  0 disk
      ```

------

1. Extend the file system.

   1. Get the name, size, type, and mount point for the file system that you need to extend. Use the **df -hT** or **lsblk -f** command.

------
#### [ Nitro instance example ]

      The following example output for the **df -hT** command shows that the `/dev/nvme0n1p1` file system is 8 GB in size, its type is `xfs`, and its mount point is `/`.

      ```
      [ec2-user ~]$ df -hT
      Filesystem      Type  Size  Used Avail Use% Mounted on
      /dev/nvme0n1p1  xfs   8.0G  1.6G  6.5G  20% /
      /dev/nvme1n1    xfs   8.0G   33M  8.0G   1% /data
      ...
      ```

------
#### [ Xen instance example ]

      The following example output for the **df -hT** command shows that the `/dev/xvda1` file system is 8 GB in size, its type is `ext4`, and its mount point is `/`.

      ```
      [ec2-user ~]$ df -hT
      Filesystem      Type   Size    Used   Avail   Use%   Mounted on
      /dev/xvda1      ext4   8.0G    1.9G   6.2G    24%    /
      /dev/xvdf1      xfs    24.0G   45M    8.0G    1%     /data
      ...
      ```

------
      + If the file system size is smaller than the volume size, continue to the next step (3b).
      + If the file system size is equal to the volume size, then it does not need to be extended. In this case, skip the remaining steps - the partition and file system have been extended to the new volume size.

       

   1. The commands to extend the file system differ depending on the file system type. Choose the following correct command based on the file system type that you noted in the previous step.
      + **[XFS file system]** Use the **xfs\$1growfs** command and specify the mount point of the file system that you noted in the previous step.

------
#### [ Nitro and Xen instance example ]

        For example, to extend a file system mounted on `/`, use the following command.

        ```
        [ec2-user ~]$ sudo xfs_growfs -d /
        ```

------
**Troubleshooting tips**  
`xfs_growfs: /data is not a mounted XFS filesystem`: Indicates that you specified the incorrect mount point, or the file system is not XFS. To verify the mount point and file system type, use the **df -hT** command.
`data size unchanged, skipping`: Indicates that the file system already extends the entire volume. If the volume has no partitions, [ confirm that the volume modification succeeded](monitoring-volume-modifications.md). If the volume has partitions, ensure that the partition was extended as described in step 2.
      + **[Ext4 file system]** Use the **resize2fs** command and specify the name of the file system that you noted in the previous step.

------
#### [ Nitro instance example ]

        For example, to extend a file system mounted named `/dev/nvme0n1p1`, use the following command.

        ```
        [ec2-user ~]$ sudo resize2fs /dev/nvme0n1p1
        ```

------
#### [ Xen instance example ]

        For example, to extend a file system mounted named `/dev/xvda1`, use the following command.

        ```
        [ec2-user ~]$ sudo resize2fs /dev/xvda1
        ```

------
**Troubleshooting tips**  
`resize2fs: Bad magic number in super-block while trying to open /dev/xvda1`: Indicates that the file system is not Ext4. To verify file the system type, use the **df -hT** command.
`open: No such file or directory while opening /dev/xvdb1`: Indicates that you specified an incorrect partition. To verify the partition, use the **df -hT** command.
`The filesystem is already 3932160 blocks long. Nothing to do!`: Indicates that the file system already extends the entire volume. If the volume has no partitions, [confirm that the volume modification succeeded](monitoring-volume-modifications.md). If the volume has partitions, ensure that the partition was extended, as described in step 2.
      + **[Other file system]** See the documentation for your file system for instructions.

   1. Verify that the file system has been extended. Use the **df -hT** command and confirm that the file system size is equal to the volume size.

## Windows instances
<a name="extend-windows"></a>

Use one of the following methods to extend the file system on a Windows instance.

------
#### [ Disk Management utility ]

**To extend a file system using Disk Management**

1. Before extending a file system that contains valuable data, it is a best practice to create a snapshot of the volume that contains it in case you need to roll back your changes. For more information, see [Create Amazon EBS snapshots](ebs-creating-snapshot.md).

1. Log in to your Windows instance using Remote Desktop.

1. In the **Run** dialog, enter **diskmgmt.msc** and press Enter. The Disk Management utility opens.  
![\[Windows Server Disk Management Utility\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/Expand-Volume-Win2008-before.png)

1. On the **Disk Management** menu, choose **Action**, **Rescan Disks**.

1. Open the context (right-click) menu for the expanded drive and choose **Extend Volume**.
**Note**  
**Extend Volume** might be disabled (grayed out) if:  
The unallocated space is not adjacent to the drive. The unallocated space must be adjacent to the right side of the drive you want to extend.
The volume uses the Master Boot Record (MBR) partition style and it is already 2TB in size. Volumes that use MBR cannot exceed 2TB in size.  
![\[Windows Server Disk Management Utility\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/Expand-Volume-Win2008-before-menu.png)

1. In the **Extend Volume** wizard, choose **Next**. For **Select the amount of space in MB**, enter the number of megabytes by which to extend the volume. Generally, you specify the maximum available space. The highlighted text under **Selected** is the amount of space that is added, not the final size the volume will have. Complete the wizard.  
![\[Windows Server Extend Volume Wizard\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/Extend-Volume-Wizard-Win2008.png)

1. If you increase the size of an NVMe volume on an instance that does not have the AWS NVMe driver, you must reboot the instance to enable Windows to see the new volume size. For more information about installing the AWS NVMe driver, see [AWS NVMe drivers](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/aws-nvme-drivers.html).

------
#### [ PowerShell ]

Use the following procedure to extend a Windows file system using PowerShell.

**To extend a file system using PowerShell**

1. Before extending a file system that contains valuable data, it is a best practice to create a snapshot of the volume that contains it in case you need to roll back your changes. For more information, see [Create Amazon EBS snapshots](ebs-creating-snapshot.md).

1. Log in to your Windows instance using Remote Desktop.

1. Run PowerShell as an administrator.

1. Run the `Get-Partition` command. PowerShell returns the corresponding partition number for each partition, the drive letter, offset, size, and type. Note the drive letter of the partition to extend.

1. Run the following command to rescan the disk.

   ```
   "rescan" | diskpart
   ```

1. Run the following command, using the drive letter you noted in step 4 in place of **<drive-letter>**. PowerShell returns the minimum and maximum size of the partition allowed, in bytes.

   ```
   Get-PartitionSupportedSize -DriveLetter <drive-letter>
   ```

1. To extend the partition to a specified amount, run the following command, entering the new size of the volume in place of **<size>**. You can enter the size in `KB`, `MB`, and `GB`; for example, `50GB`.

   ```
   Resize-Partition -DriveLetter <drive-letter> -Size <size>
   ```

   To extend the partition to the maximum available size, run the following command.

   ```
   Resize-Partition -DriveLetter <drive-letter> -Size $(Get-PartitionSupportedSize -DriveLetter <drive-letter>).SizeMax
   ```

   The following PowerShell commands show the complete command and response flow for extending a file system to a specific size.  
![\[Extend a partition using PowerShell - specific\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/ebs-extend-powershell-v3-specific.png)

   The following PowerShell commands show the complete command and response flow for extending a file system to the maximum available size.  
![\[Extend a partition using PowerShell - max\]](http://docs.aws.amazon.com/ebs/latest/userguide/images/ebs-extend-powershell-v3-max.png)

------

# Detach an Amazon EBS volume from an Amazon EC2 instance
<a name="ebs-detaching-volume"></a>

You need to detach an Amazon Elastic Block Store (Amazon EBS) volume from an instance before you can attach it to a different instance or delete it. Detaching a volume does not affect the data on the volume.

**Topics**
+ [Considerations](#considerations)
+ [Unmount and detach a volume](#umount-detach-volume)
+ [Troubleshoot](#detach-troubleshoot)

## Considerations
<a name="considerations"></a>
+ You can detach an Amazon EBS volume from an instance explicitly or by terminating the instance. However, if the instance is running, you must first unmount the volume from the instance.
+ If an EBS volume is the root device of an instance, you must stop the instance before you can detach the volume.
+ You can reattach a volume that you detached (without unmounting it), but it might not get the same mount point. If there were writes to the volume in progress when it was detached, the data on the volume might be out of sync.
+ After you detach a volume, you are still charged for volume storage as long as the storage amount exceeds the limit of the AWS Free Tier. You must delete a volume to avoid incurring further charges. For more information, see [Delete an Amazon EBS volume](ebs-deleting-volume.md).

## Unmount and detach a volume
<a name="umount-detach-volume"></a>

Use the following procedures to unmount and detach a volume from an instance. This can be useful when you need to attach the volume to a different instance or when you need to delete the volume.

**Topics**
+ [Step 1: Unmount the volume](#unmount)
+ [Step 2: Detach the volume from the instance](#detach)
+ [Step 3: (*Windows instances only*) Uninstall the offline device locations](#uninstall)

### Step 1: Unmount the volume
<a name="unmount"></a>

#### Linux instances
<a name="unmount-linux"></a>

From your Linux instance, use the following command to unmount the `/dev/sdh` device.

```
[ec2-user ~]$ sudo umount -d /dev/sdh
```

#### Windows instances
<a name="unmount-windows"></a>

From your Windows instance, unmount the volume as follows.

1. Start the Disk Management utility.
   + (Windows Server 2012 and later) On the taskbar, right-click the Windows logo and choose **Disk Management**.
   + Windows Server 2008) Choose **Start**, **Administrative Tools**, **Computer Management**, **Disk Management**.

1. Right-click the disk (for example, right-click **Disk 1**) and then choose **Offline**. Wait for the disk status to change to **Offline** before opening the Amazon EC2 console.

### Step 2: Detach the volume from the instance
<a name="detach"></a>

To detach the volume from the instance, use one of the following methods:

------
#### [ Console ]

**To detach an EBS volume**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**. 

1. Select the volume.

1. Choose **Actions**, **Detach volume**. 

1. When prompted for confirmation, choose **Detach**.

------
#### [ AWS CLI ]

**To detach an EBS volume from an instance**  
After unmounting the volume, use the [detach-volume](https://docs.aws.amazon.com/cli/latest/reference/ec2/detach-volume.html) command.

```
aws ec2 detach-volume --volume-id vol-01234567890abcdef
```

------
#### [ PowerShell ]

**To detach an EBS volume from an instance**  
After unmounting the volume, use the [Dismount-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/Dismount-EC2Volume.html) cmdlet.

```
Dismount-EC2Volume -VolumeId vol-01234567890abcdef
```

------

### Step 3: (*Windows instances only*) Uninstall the offline device locations
<a name="uninstall"></a>

When you unmount and detach a volume from an instance, Windows flags the device location as offline. The device location remains offline after rebooting, and stopping and restarting the instance. When you restart the instance, Windows might mount one of the remaining volumes to the offline device location. This causes the volume to be unavailable in Windows. To prevent this from happening and to ensure that all volumes are attached to online device locations the next time Windows starts, perform the following steps:

1. On the instance, open the Device Manager.

1. In the Device Manager, select **View**, **Show hidden devices**.

1. In the list of devices, expand the **Storage controllers** node.

   The device locations to which the detached volumes were mounted are named `AWS NVMe Elastic Block Storage Adapter` and they should appear greyed out.

1. Right-click each greyed out device location named `AWS NVMe Elastic Block Storage Adapter`, select **Uninstall device** and choose **Uninstall**.
**Important**  
Do not select the **Delete the driver software for this device** check box.

## Troubleshoot
<a name="detach-troubleshoot"></a>

The following are common problems encountered when detaching volumes, and how to resolve them.

**Note**  
To guard against the possibility of data loss, take a snapshot of your volume before attempting to unmount it. Forced detachment of a stuck volume can cause damage to the file system or the data it contains or an inability to attach a new volume using the same device name, unless you reboot the instance.
+ If you encounter problems while detaching a volume through the Amazon EC2 console, it can be helpful to use the **describe-volumes** CLI command to diagnose the issue. For more information, see [describe-volumes](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volumes.html).
+ If your volume stays in the `detaching` state, you can force the detachment by choosing **Force Detach**. Use this option only as a last resort to detach a volume from a failed instance, or if you are detaching a volume with the intention of deleting it. The instance doesn't get an opportunity to flush file system caches or file system metadata. If you use this option, you must perform the file system check and repair procedures. 
+ If you've tried to force the volume to detach multiple times over several minutes and it stays in the `detaching` state, you can post a request for help to [AWS re:Post](https://repost.aws/). To help expedite a resolution, include the volume ID and describe the steps that you've already taken.
+ When you attempt to detach a volume that is still mounted, the volume can become stuck in the `busy` state while it is trying to detach. The following output from **describe-volumes** shows an example of this condition:

  ```
  "Volumes": [
      {
          "AvailabilityZone": "us-west-2b",
          "Attachments": [
              {
                  "AttachTime": "2022-07-21T23:44:52.000Z",
                  "InstanceId": "i-1234567890abcdef0",
                  "VolumeId": "vol-01234567890abcdef",
                  "State": "busy",
                  "DeleteOnTermination": false,
                  "Device": "/dev/sdf"
              }
          ...
      }
  ]
  ```

  When you encounter this state, detachment can be delayed indefinitely until you unmount the volume, force detachment, reboot the instance, or all three.

# Delete an Amazon EBS volume
<a name="ebs-deleting-volume"></a>

You can delete an Amazon EBS volume that you no longer need. After deletion, its data is gone and the volume can't be attached to any instance. So before deletion, you can store a snapshot of the volume, which you can use to re-create the volume later. 

You can't delete a volume if it's attached to an instance. To delete a volume, you must first detach it. For more information, see [Detach an Amazon EBS volume from an Amazon EC2 instance](ebs-detaching-volume.md).

If you delete a volume that matches a Recycle Bin retention rule, the volume is retained in the Recycle Bin instead of being immediately deleted. For more information, see [Recycle Bin](recycle-bin.md).

------
#### [ Console ]

**To delete an EBS volume**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Volumes**.

1. Select the volume. Verify that the volume is in the **Available** state.

1. Choose **Actions**, **Delete volume**.

   If this option is disabled, the volume is attached to an instance and can't be deleted.

1. When prompted for confirmation, enter **delete**, and then choose **Delete**.

------
#### [ AWS CLI ]

**To check whether an EBS volume is in use**  
Use the [describe-volumes](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volumes.html) command. If the volume is in use, the state is `in-use`. Otherwise, it is `available`.

```
aws ec2 describe-volumes \
    --volume-id vol-01234567890abcdef \
    --query Volumes[*].State \
    --output text
```

**To delete an EBS volume**  
Use the [delete-volume](https://docs.aws.amazon.com/cli/latest/reference/ec2/delete-volume.html) command.

```
aws ec2 delete-volume --volume-id vol-01234567890abcdef
```

------
#### [ PowerShell ]

**To check whether an EBS volume is in use**  
Use the [Get-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2Volume.html) cmdlet. If the volume is in use, the state is `in-use`. Otherwise, it is `available`.

```
(Get-EC2Volume `
    -VolumeId vol-01234567890abcdef).State.Value
```

**To delete an EBS volume**  
Use the [Remove-EC2Volume](https://docs.aws.amazon.com/powershell/latest/reference/items/Remove-EC2Volume.html) cmdlet.

```
Remove-EC2Volume -VolumeId vol-01234567890abcdef
```

------