Why is my EBS volume stuck in the attaching state?

4 分的閱讀內容

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

The maximum number of EBS volumes that your EC2 instance can have depends on the operating system and instance type. If your instance reaches the instance level limit, you can change the instance type. There are instance volume limits for Linux instances and instance volume limits for Windows instances.

To resolve attaching state issues, see Change the instance type for Linux instances and Change the instance type for Windows instances.

Verify the device name for the EBS volume

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.

For more details on names for devices, see Device names on Linux instances and Device names on Windows instances.

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:

Important: Before you begin, back up your data. For more information, see Best practices for Amazon EC2 for Linux and Best practices for Windows on Amazon EC2.

  1. Open the EC2 console.
  2. In the navigation pane, choose Volumes, and then select the volume that's experiencing issues.
  3. Choose Actions, Force detach volume.
  4. 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:

  1. Reboot the instance.
  2. Stop and start the instance to migrate the instance to new underlying hardware.
  3. If the issue persists after you start and stop the instance, create a Support case.

Important: When you stop an instance, you lose all of the data stored on any instance store volume. For more information, see Instance store volume and data lifetime and Root device storage concepts.

Related information

Attach an Amazon EBS volume to an instance (for Linux)

Attach an Amazon EBS volume to an instance (for Windows)

Mapping disks to volumes on your Windows instance