I’ve created a neat little AWS Lambda function for creating snapshots of the EC2 instances in our account (probably I’ll post separately about that). The Lambda function is working pretty fine and is creating one daily snapshot of the instance, just in case. After verifying that the snapshots are correctly created I wanted to test out restoring an instance from such a snapshot.
However when I created an AMI from the snapshot and launched this AMI into a new instance, the instance wouldn’t start. In the AWS EC2 console when you right click on the instance in the context menu you can select Instance Settings -> Get System Log. Looking at this system log I could see the following error message:
EXT3-fs: sda1: couldn't mount because of unsupported optional features (240). EXT2-fs: sda1: couldn't mount because of unsupported optional features (244). Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)
So now it was clear that the instance is not working because it can’t mount the required volumes. After digging around a little bit I found why this happens. When launching the replacement instance from the snapshot I used the default Amazon Kernel Image (AKI). However this default AKI doesn’t support it seems the features that were used in the original AMI that was using a custom kernel image.
So the solution to this problem is to look-up your original instance and see what AKI it uses. Then when launching the instance from the backup snapshot choose this kernel image instead of the default one. And it will work.