Suppose the filesystem /opt on /dev/hda8 has filesystem errors. We need to unmount /opt before running fsck.
umount /opt
If the filesystem is not being used, nothing will be returned, otherwise, filesystem busy error will be returned. A better practise is to turn the system into a maintenance mode (single-user mode).
fsck -a -t ext2 /dev/hda8
Filesystem checking is done for the ext2 filesystem on /dev/hda8. Any error will be fixed automatically.
When everything alrights, remount the filesystem.
mount /dev/hda8 /opt