Goal This project to fix the EC2 booting issues using below methods
- EC2 Serial Console
- Rescue instance
Pre-Requisites:
- You must have an AWS account to create infrastructure resources on AWS cloud.
Booting Issues
- In this problem statement you are fixing the incorrect entries in the /etc/fstab which is causing the booting to get halted and not to initialize the network for you to login.
Reproduce the Issue:
- First you create a problem with incorrect entries in the /etc/fstab.
- Login to AWS and create 5GB EBS volume in the same AZ of the EC2 instance and attach EBS volume with the name /dev/xvdf to the Instance.
- Create File System ext4 on the new EBS volume attached in the previous step
- Mount the File System on /data directory
- Verify File System utilization using ‘df -h’ command – This command must show /data file system
- Create file ‘f1’ in the /data file system.
- Now to auto mount this file system after the EC2 restart the File System entry must be updated in the /etc/fstab – Add below [note the below syntax is incorrect and ec2 boot issues will arise ]
- /dev/xvdf /data ext4 defaults 1 [Note that some times the volume name could be nvme1nx on nitro system architecture systems]
- Restart EC2 Instance from AWS console.
- Now Verify the EC2 status from instance screenshot that instance halted in booting process and you can not connect to EC2 instance from SSH client.
Fix the Booting Issues:
Use below methods to fix the booting issues based on the type of the issues that are reported by the EC2 instance. You can get the issue type from the Instance screenshot.
EC2 Serial Console
- Open Serial Console from AWS console to start the EC2 instance without network services like SSH will be started .
- Once the Serial Console is available follow the steps to fix the incorrect /etc/fstab entries.
- /dev/xvdf /data ext4 defaults 1 1 [Note that some times the volume name could be nvme1n1 on nitro system architecture systems]
Rescue instance
- Stop original problematic EC2 Instance
- Detach Root Volume
- Launch new EC2 instance which will be now a Rescue Instance
- Attached the root volume that was detached in step 2 as data volume to Rescue Instance
- Mount as file system without being formatted.
- Correct the fstab syntax issues
- /dev/xvdf /data ext4 defaults 1 1 [Note that some times the volume name could be nvme1n1 on nitro system architecture systems]
- Detach the volume from the rescue instance.
- Terminate the Rescue Instance as this instance is not required anymore.
- Now, Attach the root volume back again to the original EC2 Instance.
- Start EC2 instances. Now the Instance should come up cleanly.
Validation
- Verify that the EC2 instance is now started successfully.
Please comment below which type of issues can be fixed in Serial Console and Which issues can be fixed in using Rescue Instance.
Solution
Follow the LINK to check for the solution.
© Edwiki Trainings – Click HERE If you are interested to learn more on Cloud & DevOps stack.