My Amazon EBS volume is stuck in the "attaching" state

Last updated: 2019-06-25

I attached my Amazon Elastic Block Store (Amazon EBS) to my Amazon Elastic Compute Cloud (Amazon EC2) instance, but it’s still in the attaching state after 10-15 minutes.  

Resolution

Check that the device name you specified when you attempted to attach the EBS volume isn't already in use. If you specify a device name that's already being used by the block device driver of the EC2 instance, the operation fails.

When attaching an EBS volume to an Amazon EC2 instance, you can specify a device name for the volume (by default, one is filled in for you). The block device driver of the EC2 instance mounts the volume and assigns a name. The volume name can be different from the name that you assign.

For more details on device naming, see Device Naming on Linux Instances or Device Naming on Windows Instances.

If you specify a device name that is not in use by Amazon EC2, but is being used by the block device driver within the EC2 instance, the attachment of the Amazon EBS volume does not succeed. Instead, the EBS volume is stuck in the attaching state. This is usually due to one of the following reasons:

The block device driver is remapping the specified device name

On an HVM EC2 instance, /dev/sda1 remaps to /dev/xvda. If you attempt to attach a secondary Amazon EBS volume to /dev/xvda, the secondary EBS volume will not successfully attach to the instance. This can cause the EBS volume to be stuck in the attaching state.

The device name was not released by the block device driver

If a user has initiated a forced detach of an Amazon EBS volume, the block device driver of the Amazon EC2 instance may not immediately release the device name for reuse. Attempting to use that device name when attaching a volume causes the volume to be stuck in the attaching state. You must either choose a different device name or reboot the instance.

You can resolve most issues with volumes stuck in the attaching state by following these steps:

Important: Before you begin, be sure your data is backed up. For more information, see Best Practices for Amazon EC2.

  1. In the Volumes pane of the Amazon EC2 console, select the volume.
  2. Open the Actions menu and then choose Force Detach Volumes.
  3. Attempt to attach the volume to the instance, again, but use a different device name. For example, use /dev/sdg instead of /dev/sdf.
    Note: The instance must be in the running state.

If these steps don’t resolve the issue, or you must use the device name that is not working, reboot your instance.