How to detach root volume from Amazon EC2 instance?
Question: How to detach root volume from the Amazon EC2 instance?
Answer: There could be multiple different reasons, but I generally do that to troubleshoot the booting issue, it could be related to some BCD error or some driver related or some service not starting during boot. It’s easy for me to troubleshoot in this way.
Note: If you want to detach the root volume of an instance, make sure the instance is in the stopped state.
Select the instance on the console
Check for the root volume (/dev/sda1)
click on /dev/sda1 → This will give an EBS Volume ID
Click on that volume ID that will redirect to the “volume” section
Make a note of the volume ID before detaching and its device name ( In this case it is /dev/sda1)
Observer, the state is showing as “In Use”
To detach that volume.
Click on “Action” (Make sure the volume is selected)
Select “Detach Volume”
Once the volume is detached from an instance, the state changes from “In Use” to “Available”
How to attach the volume to another instance?
- You need to know the volume ID that you are going to attach.
- You need to know the instance ID where the volume needs to be attached.
Select the volume(This should be in a state as “Available”)
Put the value of instance id
Give some device name (In this case we gave xvdp)
Then click on Attach
Note: Make sure the volume (EBS) and the instance are on the same availability zone.
I have detached my EC2 server root volume and attached it to ther EC2 instance (Debug instance).
How would that be helpful for me?
To make it helpful. You need to RDP to your “debug instance”
Go to the Disk manager.
You will find something similar to this.
Here, you can see, the disk1 is showing as “Offline” [ In your case it may be disk2 or disk3, based on how many disks you already had on the debug instance]
Right-click on “Disk 1” and select “Online”
This will automatically mount the volume to the next available drive letter, in my case it mounted to D:\
Now, you are ready to do the troubleshooting based on your use case.
Checkout our Aws Cloud Migration Services Strategy.
I will try to put some use cases in the near future in this scenario.
Till then you can go through our other blogs. Apart from Cloud Migrations Services, Contact Lia Infraservices is also an expert Digital Marketing Company in Chennai and a proven Mobile App Development Company in Chennai for your all kinds of Android and iOS Mobile App Development Services.