Tuesday 16 April 2019

How to resolve booting from the Wrong Volume issue by Raj Gupta

In some situations, we may find that a volume other than the volume attached to /dev/xvda or /dev/ sda has become the root volume of our EC2 instance. This can happen when we have attached the root volume of another instance, or a volume created from the snapshot of a root volume, to an instance with an existing root volume.



In the below pic, I have 2 volume attached with my production server



If we check the label of both volumes, we see that they both contain the / label:

[root@ip-172-31-93-246 ~]# sudo e2label /dev/xvda1
/

[root@ip-172-31-93-246 ~]# sudo e2label /dev/xvdf1
/


So we could end up having /dev/xvdf1 become the root device that our instance boots to after the initial ramdisk runs, instead of the /dev/xvda1 volume from which we had intended to boot.

 To solve this, use the  e2label command to change the label of the attached volume that you do not want to boot from. 

To change the label of an attached ext4 volume

1. Use the e2label command to change the label of the volume to something other than /.

[root@ip-172-31-93-246 ~]# sudo e2label /dev/xvdf1 old/

2. Verify that the volume has the new label

[root@ip-172-31-93-246 ~]# sudo e2label /dev/xvdf1
old/

In this way we can solve the issue. 

No comments:

Post a Comment