How can I check /dev/xvda1?
Solution 1:
Most Linuxes these days should perform a forced fsck at boot time when the file /forcefsck is present on the system. If you are at liberty to reboot the VM, run
touch /forcefsck
Then reboot at your convenience
Solution 2:
For our ec2 ubuntu instance, the above answers did not work completely.
On Ubuntu, by default, the check is not enabled in the rcS file. So
- Edit rcS file sudo vi /etc/default/rcS
below the line
#FSCKFIX=no
Add
FSCKFIX=yes
- Edit fstab file. sudo vi /etc/fstab
Look for the the record for / and if the last digit is '0' change it to '1'. The last field is fsckorder and is used by fsck to decide the order of checking disks. If the value is '0' that disk is skipped.
For e.g.,
LABEL=cloudimg-rootfs / ext4 defaults,discard 0 0
to
LABEL=cloudimg-rootfs / ext4 defaults,discard 0 1
-
Create /forcefsck file
sudo touch /forcefsck
Reboot from ec2 console.
Revert the fsckorder value from '1' to '0' in /etc/fstab
Delete the line FSCKFIX=yes
to get back rcS file to original state.
Hope it helps.
Solution 3:
Since you cannot boot into live disc, this is may sounds a bit weird, but i guess it'll do the job)
high level:
- boot into new (another) instance.
- attach storage from old instance to new (current).
- run
fsck
. - detach storage from new (current) and reattach it to old instance.
Solution 4:
I just do 3 steps below and issue resolved.
- Add "FSCKFIX=yes" to /etc/default/rcS
- sudo touch /forcefsck
- sudo reboot
Thanks all.