Learn how to resolve the “Instance does not have a volume attached at root (/ dev / sda1)” error on AWS. This error occurs when the device name is not displayed properly when adding a volume to an EC2 instance.
Error Details: Instance does not have a volume attached at root (/ dev / sda1)
This error occurs when the device name specified when attaching the root tag is different from the root device attached to the EC2 instance at startup.
How to fix this error
To resolve this error, follow these steps:
Step 1. Make a note of the device name causing the error when the EC2 instance starts.
In the above screen, the error is related to the device name / dev / sda1… We need to use the same device name when passing the volume to the EC2 instance.
Step 2. Detach the currently mounted volume from EC2
- Go to ELASTIC BLOCK STORE -> Volumes and select the corresponding attached volume. This volume will have an “in-use” status.
- Then click on the button Detach volume optionAction from the dropdown menu.
Step 3. Attach the volume in EC2
Try an attached volume like EC2. However, make sure you don’t use default “Device“, such as “/ dev / sdf”As below, pointing to the EC2 example.
Do not use the default device name.
Instead of using the device name as / dev / sda1, which we already noted in step 1 as shown below, and click Attach:
Step 4. Launch an EC2 instance
This time, when you try to start the instance, the “Instance does not have a volume attached at root (/ dev / sda1)” error will not appear and your EC2 instance will start successfully.