When attaching an EBS volume to an instance, if you specify a device name that is already being used by the block device driver of the EC2 instance, the attachment of the EBS volume fails and the EBS volume can be stuck in the attaching state.

When you attach an EBS volume to an 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 also assigns a volume name when mounting the volume, and that name might be different from the name that you assign.

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

For example, if your HVM EC2 instance has a root device attached on /dev/sda1, and you attempt to attach a secondary EBS volume to /dev/xvda, the secondary EBS volume will not successfully attach to the instance. This is because on an HVM instance, /dev/sda1 remaps to /dev/xvda, so an attempt to attach a volume to /dev/xvda results in the volume being stuck in the attaching state.

If a user has initiated a forced detach of an EBS volume, the block device driver of the EC2 instance might not immediately release the device name for reuse, and attempting to use that device name when attaching a volume causes the volume to be stuck in the attaching state.

Before taking any action, make sure your data is backed up, either with an EBS snapshot or a manual backup solution. After your data is backed up, you can resolve most issues with volumes stuck in the attaching state by following these steps:

In the Volumes pane of the Amazon EC2 console, select the volume and choose Force Detach Volumes from the Actions menu.

When the instance is in the “running” state, attempt to attach the volume to the instance again.

If these steps don’t resolve the issue, and the device driver still appears to be busy, reboot the instance.