There are times when you want to do a filesystem health check. However, it’s not safe to run fsck on a mounted volume. The best option is to run it on next boot. To do that on Ubuntu (applies to many other Linux favours as well), run the following command:
$ echo y | sudo tee /forcefsck
The y written to the file ensures that fsck doesn’t wait for user input. This is useful for remote connections.
The reverse (to skip fsck) is the following:
$ sudo touch /fastboot