DevOps | Cloud | Analytics | Open Source | Programming





How To Fix - "AWS EBS Volume Stuck in the "Attaching" State?



In this post, we will explore How To Fix - "AWS EBS Volume Stuck in the "Attaching" State. Sometimes even after attaching AWS Elastic Block Store (EBS) to your AWS Elastic Compute Cloud (EC2) instance, it stays in the "attaching" state for sometime. Let's explore how we can fix  this issue.  

Check 1:

Firstly do the basic checks if you have correctly done the attach process.

  • A sample attach-volume command


aws ec2 attach-volume --volume-id vol-zzzzzzz --instance-id i-yyyyyyyyyyyyyyyyy --device /dev/sdf
{
"AttachTime": "2022-05-25T23:43:12.060000+00:00",
"Device": "/dev/sdf",
"InstanceId": "i-yyyyyyyyyyyyyyyyy ",
"State": "attaching",
"VolumeId": "vol-zzzzzzz "
}


 

  • Check what do you get with the lsblk command


lsblk


 

  • Check the NVMe Device name


sudo ebsnvme-id /dev/nvme0n1 -u


OR



sudo ebsnvme-id /dev/nvme0n1 -u


 

  • List all the NVMe devices and check with which has the associated device name.
 



$ DEV=xvda
$ lsblk | grep disk | awk '{print $1}' | while read disk; do echo -n "$disk " && sudo ebsnvme-id -b /dev/$disk; done | grep $DEV | awk '{print $1}'
nvme0n1


   

Check 2:

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.

  • Verify the device name that you specified while attaching the EBS volume - is already in use or not.
    • In case the specified device name is being used already by the EC2 block device driver, it will fails.
 

  • While attaching an EBS volume to an AWS EC2 instance, you have the option to correlate a device name for the volume. If you dont do this, then by default, one is filled in.
    • 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 specify.
 

  • There might be a scenario - that you used a device name - which is not in-use by AWS EC2 instance.. But is used by the block device driver within the EC2 instance. The attachment of the AWS EBS volume fails in such a case. The EBS volume remains stuck in the attaching state.
    • One reason for this can be - the block device driver is remapping the specified device name. e.g. say while /dev/sda1 is remapped to /dev/xvda and you try to attach a secondary AWS EBS volume to /dev/xvda, the secondary EBS volume will be stuck in the attaching state - instead of getting attached.
    • Another reason can be - the block device driver never released the device name i.e. the block device driver might still be using it. And when you try to use such a device name to attach a volume, it will stay stuck in the attaching state.
   

Check 3:

Assuming you had followed the Check 1 & Check 2 steps, you can proceed with the subsequent steps -

  • Force Detach the Volume.
 

  • Reboot or Restart the EC2 instance.
 

  • If still you are facing the same issue, you could use a Different device name.
  Hope the above process helps to solve the issue.    

Other Interesting Reads -

   



some of the volumes attached to instance are impaired. please review the state of your volumes ,mount ebs volume to ec2 instance linux ,how to check ebs volume usage ,aws volume state error ,volume impaired aws ,attachable-volumes-aws-ebs ,aws ec2 attach-volume ,aws detach volume and attach to another instance , ,AWS EBS Volume Stuck in the "Attaching" State ,ebs volume stuck in attaching ,aws ebs volume stuck in attaching ,openstack volume stuck in attaching state ,ebs attached volume not showing up windows ,ebs volume attachment limit ,how can an ebs volume that is currently attached ,how to attach ebs volume ,ebs volume attach to ec2 ,ebs volume stuck in detaching ,ebs volume detach and attach ,ebs attached volume not showing up ,ebs volume stuck in attaching state ,how to detach and attach volume in aws ,aws ebs volume increase size ,aws ebs volume stuck detaching ,aws ebs volume kubernetes ,aws ebs volume increase linux ,aws ebs volume size increase , ,AWS EBS Volume "Attaching" State ,ebs volume stuck in attaching ,attach ebs volume to existing ec2 instance ,ebs volume attach to ec2 ,aws ebs volume documentation ,aws ebs volume stuck in attaching ,aws ebs volume kubernetes ,ebs attached volume not showing up ,ebs attached volume not showing up windows ,ebs volume attachment limit ,how can an ebs volume that is currently attached ,how to attach ebs volume ,ebs volume stuck in detaching ,ebs volume detach and attach ,ebs volume stuck in attaching state ,mount existing ebs volume to ec2 instance ,mount existing ebs volume to ec2 instance linux ,attach ebs volume to running instance ,can we attach ebs volume to more than one ec2 instance at the same time ,can we attach an ebs volume to more than one ec2 instance ,attach existing volume to ec2 instance ,attach ebs volume to ec2 instance ubuntu ,attach ebs volume to ec2 instance as root ,how to add ebs volume to existing ec2 instance ,attach new volume to ec2 instance ,attach ebs volume to ec2 instance windows ,ebs volumes attached to stopped ec2 instances ,format ebs volume to attach ec2 instance ,ensure that ebs volumes attached to ec2 instances are encrypted ,attach ebs volume to ec2 instance linux ,attach ebs volume to ec2 instance terraform ,attach ebs volume to ec2 instance cloudformation ,attach an ebs volume to an ec2 instance ,attach ebs volume to ec2 instance ansible ,create ebs volume and attach it to the ec2 instance ,attach ebs volume to ec2 instance aws cli ,format ebs volume to attach on ec2 instance ,how to attach ebs volume to ec2 linux ,how to attach ebs volume to ec2 instance ,ebs attach to ec2 ,how to attach ebs volume to running ec2 instance ,attach ebs volume to ec2 instance cli ,attach ebs volume to ec2 instance cdk ,attach ebs volume to ec2 instance windows cloudformation ,mounting ebs volume to ec2 instance ,format ebs volume to attach to ec2 instance ,how many ebs volumes can be attached to an ec2 instance ,how to attach ebs volume to ec2 windows ,how to attach ebs volume to ec2 instance terraform ,attach ebs volume to ec2 instance ,mount ebs volume to ec2 linux ,how to attach and mount an ebs volume to ec2 linux instance ,add ebs volume to linux ec2 instance ,ebs volumes cannot be attached to multiple ec2 instances at a time ,attach ebs volume to multiple ec2 instances ,attach new ebs volume to ec2 instance ,attach new ebs volume to ec2 instance windows ,ebs volume mount on ec2 ,attach an ebs volume to more than one ec2 instance at the same time ,attach an ebs volume to more than one ec2 instance ,attach ebs volume to ec2 instance windows powershell ,attach ebs volume to running ec2 instance ,attach ebs volume to ec2 terraform ,attach ebs volume to ec2 instance using terraform ,attach ebs volume to ec2 instance using aws cli ,attach ebs volume to ec2 windows instance ,what is aws ebs used for ,aws add ebs volume to ec2 instance ,aws ebs volume types documentation ,aws ebs volume vs s3 ,aws ec2 ebs volume types ,is aws ebs free ,aws ebs documentation ,aws ebs volume cli ,ebs volume documentation ,aws ebs volume monitoring ,how to detach and attach volume in aws ,aws ebs volume increase size ,aws ebs volume stuck detaching ,aws ebs volume increase linux ,aws ebs volume size increase ,aws ebs persistent volume kubernetes ,what is aws ebs storage ,is aws ecs based on kubernetes ,http://volume.beta.kubernetes.io/aws-ebs-additional-resource-tags ,aws ebs kubernetes storage class ,kubernetes ebs persistent volume example ,ebs volume kubernetes ,aws ebs kubernetes ,kubernetes mount ebs volume ,mount ebs volume to kubernetes pod ,kubernetes aws ebs persistent volume ,ebs volume not showing up ,ec2 attach volume not showing up ,attaching ebs volume to windows instance ,ebs volume not showing up windows , , , ,aws ebs volume stuck in the attaching state ' ,aws ebs volume stuck in the attaching state 1 ,aws ebs volume stuck in the attaching state after update ,aws ebs volume stuck in the attaching state allocation ,aws ebs volume stuck in the attaching state at ,aws ebs volume stuck in the attaching state at once ,aws ebs volume stuck in the attaching state back ,aws ebs volume stuck in the attaching state backend ,aws ebs volume stuck in the attaching state backlog ,aws ebs volume stuck in the attaching state backup ,aws ebs volume stuck in the attaching state build ,aws ebs volume stuck in the attaching state change ,aws ebs volume stuck in the attaching state close ,aws ebs volume stuck in the attaching state command ,aws ebs volume stuck in the attaching state configuration ,aws ebs volume stuck in the attaching state data ,aws ebs volume stuck in the attaching state detection ,aws ebs volume stuck in the attaching state directory ,aws ebs volume stuck in the attaching state disk ,aws ebs volume stuck in the attaching state entry ,aws ebs volume stuck in the attaching state error ,aws ebs volume stuck in the attaching state exception ,aws ebs volume stuck in the attaching state file ,aws ebs volume stuck in the attaching state fix ,aws ebs volume stuck in the attaching state folder ,aws ebs volume stuck in the attaching state git ,aws ebs volume stuck in the attaching state graph ,aws ebs volume stuck in the attaching state group ,aws ebs volume stuck in the attaching state hierarchy ,aws ebs volume stuck in the attaching state how to ,aws ebs volume stuck in the attaching state how to fix ,aws ebs volume stuck in the attaching state id ,aws ebs volume stuck in the attaching state install ,aws ebs volume stuck in the attaching state is ,aws ebs volume stuck in the attaching state issue ,aws ebs volume stuck in the attaching state java ,aws ebs volume stuck in the attaching state jdbc ,aws ebs volume stuck in the attaching state jenkins ,aws ebs volume stuck in the attaching state job ,aws ebs volume stuck in the attaching state kernel ,aws ebs volume stuck in the attaching state key ,aws ebs volume stuck in the attaching state killer ,aws ebs volume stuck in the attaching state kubernetes ,aws ebs volume stuck in the attaching state level ,aws ebs volume stuck in the attaching state lock ,aws ebs volume stuck in the attaching state log ,aws ebs volume stuck in the attaching state login ,aws ebs volume stuck in the attaching state logo ,aws ebs volume stuck in the attaching state machine ,aws ebs volume stuck in the attaching state manager ,aws ebs volume stuck in the attaching state mode ,aws ebs volume stuck in the attaching state next ,aws ebs volume stuck in the attaching state no ,aws ebs volume stuck in the attaching state not found ,aws ebs volume stuck in the attaching state not working ,aws ebs volume stuck in the attaching state now ,aws ebs volume stuck in the attaching state park ,aws ebs volume stuck in the attaching state permission ,aws ebs volume stuck in the attaching state policy ,aws ebs volume stuck in the attaching state problem ,aws ebs volume stuck in the attaching state process ,aws ebs volume stuck in the attaching state proxy ,aws ebs volume stuck in the attaching state query ,aws ebs volume stuck in the attaching state question ,aws ebs volume stuck in the attaching state queue ,aws ebs volume stuck in the attaching state quota ,aws ebs volume stuck in the attaching state reason ,aws ebs volume stuck in the attaching state reboot ,aws ebs volume stuck in the attaching state release ,aws ebs volume stuck in the attaching state reset ,aws ebs volume stuck in the attaching state restore ,aws ebs volume stuck in the attaching state service ,aws ebs volume stuck in the attaching state set ,aws ebs volume stuck in the attaching state solution ,aws ebs volume stuck in the attaching state space ,aws ebs volume stuck in the attaching state system ,aws ebs volume stuck in the attaching state tab ,aws ebs volume stuck in the attaching state thread ,aws ebs volume stuck in the attaching state to ,aws ebs volume stuck in the attaching state to file ,aws ebs volume stuck in the attaching state unit ,aws ebs volume stuck in the attaching state university ,aws ebs volume stuck in the attaching state update ,aws ebs volume stuck in the attaching state update file ,aws ebs volume stuck in the attaching state upgrade ,aws ebs volume stuck in the attaching state user ,aws ebs volume stuck in the attaching state variable ,aws ebs volume stuck in the attaching state verification ,aws ebs volume stuck in the attaching state version ,aws ebs volume stuck in the attaching state view ,aws ebs volume stuck in the attaching state when ,aws ebs volume stuck in the attaching state windows ,aws ebs volume stuck in the attaching state windows 10 ,aws ebs volume stuck in the attaching state xbox ,aws ebs volume stuck in the attaching state xcode ,aws ebs volume stuck in the attaching state xml ,aws ebs volume stuck in the attaching state xml file ,aws ebs volume stuck in the attaching state yahoo ,aws ebs volume stuck in the attaching state yes ,aws ebs volume stuck in the attaching state yet ,aws ebs volume stuck in the attaching state zero ,aws ebs volume stuck in the attaching state ,aws ebs volume stuck in the attaching state zip ,aws ebs volume stuck in the attaching state zip file ,aws ebs volume stuck in the attaching statement ,aws ebs volume stuck in the attaching states ,aws ebs volume stuck in the touching state of ,aws ebs volume stuck in the touching state of screen ,aws ebs volume stuck in the touching state of the device ,aws ebs volume stuck in the touching state of the game ,aws ebs volume stuck in the touching state of the system ,ebs volume stuck in attaching