Why is my EBS volume stuck in the attaching state?
4 minute read
I attached my Amazon Elastic Block Store (Amazon EBS) volume to my Amazon Elastic Compute Cloud (Amazon EC2) instance. The EBS volume is still in the attaching state after 10-15 minutes.
Your EBS volume must meet certain prerequisites for you to attach the volume to EC2 Linux instances and EC2 Windows instances. To troubleshoot an EBS volume stuck in the attaching state, complete the following steps.
Verify the number of EBS volumes that the EC2 instance supports
When you attach an EBS volume to an EC2 instance, you can specify a device name for the volume. By default, a name is filled in for you. The instance's block device driver assigns a name to the volume when you mount the volume. The assigned volume name can be different from the name that you create.
Check that the device name that you specified for your EBS volume isn't already in use. If the instance's block device driver is already using the device name, then the operation to attach it fails. This is typically due to one of these reasons:
The block device driver remaps the device name
On a hardware virtual machine Amazon Machine Image (HVM AMI) instance, /dev/sda1 remaps to /dev/xvda. When you try to attach a secondary EBS volume to /dev/xvda, the secondary volume can't attach to the instance. This can cause the volume to get stuck in the attaching state.
The block device driver didn't release the device name
When a user forces an EBS volume to detach, the EC2 instance's block device driver might not immediately release the device name for reuse. A volume might get stuck in the attaching state when you try to reuse a device name.
Resolve the EBS volume stuck in the attaching state
You can resolve most issues with EBS volumes stuck in the attaching state by completing these steps:
In the navigation pane, choose Volumes, and then select the volume that's experiencing issues.
Choose Actions, Force detach volume.
Use a different device name and try to attach the volume to the EC2 instance again. For example, in Linux instances, use /dev/sdg instead of /dev/sdf. In Windows instances, use /dev/xvdg instead of /dev/xvdf.
Note: The instance must be in the running state.
If the previous steps to troubleshoot the issue don't resolve the issue or if you must use a device name that isn't working, complete these steps: