How to run fsck on a mounted filesystem

Question: 

I'm running Debian Linux and my filesystem has gotten errors and some of the files can't be read. I want to run fsck to correct these errors, but they can't be corrected because I'm running it on a mounted filesystem, and I can't unmount it because it's the root partition.

How can I correct filesystem errors and salvage inconsistencies on a mounted filesystem using fsck?

Answer: 

fsck can't correct most errors when run on a mounted filesystem. In order to correct your errors you need to restart the system in the single user mode and run fsck again.

Enter command prompt at computer start (check your Linux distro manual to learn how to do it or follow on-screen instructions) and type the following command:

boot -s

This will load kernel in the single user mode. Hit enter when prompted for shell path and run fsck. Correct any errors by answering "y" and reboot going back to multi-user mode.

Tags: