Why is my Amazon EBS volume stuck in the "attaching" state?
Last updated: 2020-09-24
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.
Check that the device name you specified when you attempted to attach the EBS volume isn't already in use. If the specified device name is 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.
If you specify a device name that's not in use by Amazon EC2, but is used by the block device driver within the EC2 instance, the attachment of the Amazon EBS volume fails. 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 can't successfully attach to the instance. This can cause the EBS volume to be stuck in the attaching state.
The block device driver didn't release the device name
If a user has initiated a forced detach of an Amazon EBS volume, the block device driver of the Amazon EC2 instance might 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, back up your data. For more information, see Best practices for Amazon EC2.
- In the Volumes pane of the Amazon EC2 console, select the volume.
- Open the Actions menu and then choose Force Detach Volumes.
- 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 if you must use the device name that isn't working, try the following procedures:
- Reboot the instance.
- Stop and start the instance to migrate it to new underlying hardware. Keep in mind that instance store data is lost when you stop and start an instance. If your instance is instance store-backed or has instance store volumes containing data, the data is lost when you stop the instance. For more information, see Determining the root device type of your instance.