Running fsck on EC2, Part 2
This post describes a quicker method for running fsck on an EC2 instance’s root filesystem.
Create a “/forcefsck” file in the root filesystem and configure appropriately.
colin@devcolin:~$ sudo su - root@devcolin:~# echo y > /forcefsck
The “y” character placed in the /forcefsck file will respond to all fsck prompts with the default “yes.” This will avoid the reported hangs if/when fsck prompts for user input on EC2 instance startup.
Restart the EC2 Instance
Wait for the system to restart.
Confirm that fsck Ran
You can confirm by:
- Examining the EC2 System Log from the AWS Console. Look for the lines:
fsck from util-linux 2.20.1 Checking disk drives for errors. This may take several minutes.
- Examine the “Last checked” time shown by the tune2fs utility:
colin@devcolin:~$ sudo tune2fs -l /dev/xvda1 | grep "Last checked" Last checked: Wed Mar 5 05:59:01 2014