Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Fix Filesystem Check Message When Using Ubuntu EC2 Instances

EC2

This tutorial is for you If you ever get the following message when you log into your Ubuntu EC2 Instances, and you wish to "fix it" (by actually running a check).

*** /dev/xvda1 should be checked for errors ***

Steps

Edit your /etc/fstab file and find the line that mounts your root filesystem. Change the last digit from a 0 to a 1.

sudo vim /etc/fstab

Before

LABEL=cloudimg-rootfs   /        ext4   defaults,discard        0 0

After

LABEL=cloudimg-rootfs   /        ext4   defaults,discard        0 1

Now run:

SEARCH="#FSCKFIX=no"
REPLACE="FSCKFIX=yes"
FILEPATH="/etc/default/rcS"
sudo sed -i "s;$SEARCH;$REPLACE;" $FILEPATH

Now run the following command to schedule a check on the next reboot before then rebooting.

sudo touch /forcefsck
sudo reboot

References

Last updated: 16th August 2018
First published: 16th August 2018