Linux how to fix ext4 filesystem

Sometimes if server is shutdown incorrect filesystem filesystem can be corrupted and loaded in “read only” mode.

To check file system status use command:

mount | grep /dev/sd

This command show filesystem status, if filesystem is read only – you will see “ro” status: /dev/sda2 on / type ext4 (ro,readonly,data=ordered)

To fix filesystem use command:

fsck /dev/sda2

This command will fix all errors on filesystem, To apply fix enter y on keybord. When fixing is complete reboot system and check filesystem again.