How to detach root volume from Amazon EC2 instance?

How to detach root volume from Amazon EC2 instance?

Share Now
3 min read
0
(0)
5,048

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)

Creating Subnets in Amazon VPC

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)

EBS_Volume ID

EBS_Volume_Status_Check

Observer, the state is showing as “In Use”

To detach that volume.

Click on “Action” (Make sure the volume is selected)

Select “Detach Volume”

Detach-EBS_Volume

Once the volume is detached from an instance, the state changes from “In Use” to “Available”

EBS_State_After_Despatch

How to attach the volume to another instance?

Requirement:

  • 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”)

Attach_EBS_Volume

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.

Attach root EBS volume

Now, what?

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.

Disc_Manager_EBS

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”

Disc_Offline

This will automatically mount the volume to the next available drive letter, in my case it mounted to D:\

Disc_online

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.

Cheers.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave comment

Your email address will not be published. Required fields are marked with *.