Sometime if we didn’t properly shutdown a server that running linux, it will cause a crash for the filesystem.
We need a tool that able to repair it immediately, the tool is FSCK or file system consistency check.
Below is the fsck command :
Usage: fsck [-sACVRTNP] [-t fs-optlist] [filesystem] [fs-specific-options]
Example :
I have a drive /home or /dev/sda3
Then the next step is we need a root access to run the command.
We need to take down runlevel to 1 with the command below
#init 1
Unmount filesystem /home or /dev/sda3 using the command below
#umount /home or umount /dev/sda3
After that we need to do a FSCK for the partition that crashed, using the command below
#fsck -t ext3 /dev/sda3 or fsck ext3 /dev/sda3
FSCK will completely check your filesystem and this should fixed the crashed partition smoothly
Type “y” if you want to have it repair another nodes
We also able to fsck without need to press “y” all the times, we can using the command below
#fsck -y -t ext3 /dev/sda3
After finished doing fsck all files that have a problem will stored in /home/lost+found
Next We need to remount the filesystem using this command below :
#mount /home
NOTE:
Please do make sure you replace your device name /dev/sda3 of necessary.
To make sure your server running smoothly, why not we try to reboot it once again ?
#reboot
If reboot smoothly then we can say the server is running without any problem