I have a 10GB volume attached to my production EC2 instance (It's only 300MB full). In order to do backups, I created a snapshot of it. Then I created a volume from it, which I tried to attach to another EC2 instance. The volume's status shows "attaching" and it never gets attached. I have tried this 4 times, out of which only once it successfully got attached and I could mount it from the EC2 instance. During that one time, it didn't take more than a minute to get attached. All other times it gets stuck in the "attaching" state. I've waited for 3-4 hours, but no help. Only thing I can do then is 'Force detach'. I've been using web UI all this time and not CLI.
What might be going wrong? How can I debug this problem?
I had a similar problem months ago. Turns out it was a problem on Amazon side. It only got solved after contacting the Amazon folks on the ec2 forum https://forums.aws.amazon.com/forum.jspa?forumID=30
For me the actual problem was one ec2 instance - I had a few that the volume was plugged in and out sometimes. All was fine with the other instaces. Here is what the AWS team said after I opened a ticket:
"Occasionally we do see that the OS locks the Device Mapping and a way around this is either to reboot the OS which is recommended or changing the Device Mapping (ie. /dev/sdf to /dev/sdj )"
Rebooting worked but only for one reboot - then the problem reappeared. I didn't want to restart that ec2 instance every time.
I didn't check mapping it to sdj so I can't tell you if it works
What did work was to dump the faulty instance and create a new one in its place. Everything worked fine after I've done that.