Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Instance does not have a volume attached at root (/dev/sda1)

Getting error while starting ec2 instance after attaching volume: I have defined device_name as "/dev/sda1" but it still picking up "/dev/sdf".

Here is my code:

ec2_vol:
      instance: "{{ instance_id }}"
      id: "{{ ec2_vol.volume_id }}"
      device_name: "/dev/sda1"
      region: "{{ aws_region }}"
like image 870
kohi Avatar asked May 10 '16 15:05

kohi


2 Answers

You can also use aws cli:

aws ec2 attach-volume --volume-id vol-abcde12345678901e --instance-id i-acdef123456789012 --device /dev/sda1

https://docs.aws.amazon.com/cli/latest/reference/ec2/attach-volume.html#examples

like image 95
James Oguya Avatar answered Sep 21 '22 00:09

James Oguya


It seems like this works differently for literally everyone, so let me add my 2 cents and describe what worked for me.

I had attached my root volume as (literally) sda1 because that is the format described on the "attach volume" page, however, as the error message above suggests, it is looking for a device name that is literally /dev/sda1.

Detaching and re-attaching my root volume as /dev/sda1 (vs. sda1 or xvda as described in the example) solved my problem.

like image 45
Eric Herot Avatar answered Sep 19 '22 00:09

Eric Herot