Ubuntu – Force fix errors on a mounted drive – fschk

You cannot repair sda because it is mounted.

# fsck -nf /dev/sda1
fsck from util-linux 2.27.1
e2fsck 1.42.13 (17-May-2015)
Warning!  /dev/sda1 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (8436480, counted=8436421).
Fix? no
Free inodes count wrong (2182758, counted=2182753).
Fix? no
/dev/sda1: 65642/2248400 files (0.1% non-contiguous), 547584/8984064 blocks

You need to change FSCKFIX to yes

# vi  /etc/default/rcS
FSCKFIX=yes

The -F option forces fsck on reboot:
# shutdown -rF now

 

sudo touch /forcefsck
Please turn AdBlock off