Can I run fsck or e2fsck when Linux file system is mounted?
Solution 1:
No.
Do not run fsck on a live or mounted file system. fsck
is used to check and optionally repair a Linux file systems. Running fsck
on a mounted filesystem can usually result in disk and/or data corruption.
This will force a check on next boot:
sudo touch /forcefsck
So will this but it will also reboot the machine at the moment you hit enter:
shutdown -rF now
There are more ways (like telling the machine to go to init 1
and then umount the partition/disc your want to check) but these 2 are the easiest.