Check a mounted disk and fix errors on Amazon EC2
When I logged into my EC2 instance, I had the warning:
*** /dev/xvda1 should be checked for errors ***
We can't fsck /dev/xvda1 because it is mounted and in use, so I need to check this disk on startup as it is mounted, however there are a couple of things that need to be done first before you can do this on my Ubuntu EC2 instance.
First I need to enable FSCKFIX, which is off by default
sudo nano /etc/default/rcS
find the line:
#FSCKFIX=no
And change it to:
FSCKFIX=yes
Then I need to
sudo nano /etc/fstab
In my instance there was only one record, the one for "/" and its last digit, the fsckorder was '0', which tells fsck to skip the disk, so I changed it change it to '1'.
I looked for the line:
LABEL=cloudimg-rootfs / ext4 defaults,discard 0 0
and changed it to:
LABEL=cloudimg-rootfs / ext4 defaults,discard 0 1
I then needed to create: the /forcefsck file so that fsck was run on next reboot:
sudo touch /forcefsck
I then rebooted the Server from ec2 console.
After the restart I logged on again I checked that the message was gone and reset all these values back to their originals
Add new comment