Yep, it's dead easy:
/dev/sda1
This presupposes that your alternate EBS volume is bootable, of course - it has to contain the bootable OS image.
I don't have enough rep to add a comment to the selected answer, but I do want to point out that for me, /dev/sda1
did not work (did not attach as root), but using /dev/xvda
worked (attached as root). The instance is one of the newer t2.micro ones using HVM.
To elaborate on Diomidis Spinellis's comment in the the accepted answer's comments thread, it's important to check the filesystem label of the device you're attempting to switch in as your new root device. While troubleshooting my own server migration, I had to do the following before my instance would boot up:
Use the e2label
command to change the label on the ext2/ext3/ext4 filesystem you've created for your new root device.
First, check the filesystem label for your current root device.
$ sudo e2label /dev/xvda1
cloudimg-rootfs
Set the new device to have the same filesystem label.
$ sudo e2label /dev/xvdg 'cloudimg-rootfs'
In my case, the label was cloudimg-rootfs
. Sometimes it will simply be /
.
It's important to understand how e2label works; check man e2label
on your machine or visit http://linux.die.net/man/8/e2label for more information.
This is the aws suggested solution You can detach the root volume from the original instance after stopping it. The root volume is attached at /dev/sda1. Once this is detached, please attach it to the new instance. After the volume is attached, you may have to mount it from the OS. After it's mounted, you should see the data within it.
After you've done adding the new key, you can detach it and attach to the original instance at /dev/sda1.
I suggest creating a snapshot of the root volume before making any changes.
Before trying out any solutions just try out in the not important instances or spot instances
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With