Your EC2 instance fails to start? Read here to fix it if it is a mount issue.
See the system log for errors:
Seeing volume mounting issues? It means you need to fix the
/etc/fstab using another machine. Follow these steps:
- Create a new machine with the same instance family you want to recover.
- Before starting the new machine, detach the root volume from the machine you want to recover and attach it to the new machine. Rename it in case you have the
/dev/sda1in its Name tag (in AWS Console) to make sure AWS won’t attach it as a root volume to the new machine as well.
- Start the new machine
- If it is not started (due to the same root volume conflict probably), try to snapshot the old root volume, then create a new volume out of it, and then attach the new one. Sometimes volumes get messed up and the snapshot trick will fix it.
lsblkto see the name of the attached volume
mount -o nouuid /dev/nvme1n1p1 /mnt/recovered
-ohere is to overcome the issue (
mount: unknown filesystem type '(null)') of root volumes having the same UUID
defaults. This will allow the old instance to start and for you to do the right thing and change your
/dev/nvme2n1with a proper UUID to prevent it to change after a restart (to get the UUID use
- Shutdown the new machine. Detach the recovered volume and attach it back to the original machine (make sure to name it
sda1when prompted to be able to start it, otherwise you’ll get the “no root volume found” error). Start it. Done. You’ve saved the day :)
- Remember to terminate the recovery machine $$