What is FSCK? And how to perform a Linux Disk Check
What is FSCK? FSCK is the Linux file system checker, it stands for file system consistency check and runs on all Linux systems including Macs. Windows environments call the disk check utility CHKDSK. FSCK will check your filesystem for any errors and optionally, fix them as appropriate.
The Linux Disk Check should be run as routine maintenance, it’s also recommended to run this utility when you update your Kernel as the drive has to be unmounted to be scanned. When you update your Kernel you should always reboot your server so this is the ideal time to run an FSCK check.
However, sometimes you may find that your server has decided to perform a Linux disk check automatically. The FSCK utility is run if certain conditions are met;
- The filesystem is marked as “dirty” which means the data written to the filesystem does not match what was meant to be written.
- When the filesystem has been mounted a certain number of times without FSCK being run.
Running an FSCK disk check
When you run the FSCK command you can choose how the FSCK will be performed.
- Look for errors, and prompt for user interactively to decide how to resolve individual problems;
- Check for errors, then attempt to fix any errors automatically without any intervention from the user
- Check for errors, make no attempt to repair them, but display the errors on the output so the user can manually review them.
But you should never run the disk check utility on a mounted filesystem. To run the utility first unmount the system. Drop into single-user mode.
init 1
Unmount the filesystem. This assumes your filesystem is mounted as /home.
umount /home
Now you can check the system for any errors and fix them automatically. This assumes your drive is sda2, which most of our users should be using.
fsck -y /dev/sda2
Finally, reboot the server once the disk check has been completed to complete the disk check process.
How was this article? – FSCK, what is it? and what does it do to my VPS or Dedicated Serve