Properly way to use fsck on mounted storage

Hi! due to frequent power cuts, on mounted storage in nextcloudpi disk errors started to appear:

Nov 20 16:03:11 nextcloudpi kernel: [ 315.359346] EXT4-fs (sda1): error count since last fsck: 605
Nov 20 16:03:11 nextcloudpi kernel: [ 315.359379] EXT4-fs (sda1): initial error at time 1505367405: ext4_iget:4501: inode 18220209
Nov 20 16:03:11 nextcloudpi kernel: [ 315.359418] EXT4-fs (sda1): last error at time 1510904741: ext4_iget:4515: inode 18220209

How can i properly run a fsck to check disk and solve errors?

It’s as easy as this: you NEVER run fsck in any meaningful way on a currently mounted volume! Ever!

Unmount the volume and then run fsck or you risk loosing data if you don’t really know, what you’re doing.

You shoud:

  • shutdown apache2 on you RPi
  • check your mounts using mount on the cli
  • unmount the volume that is mounted from /dev/sda1
  • then run fsck -v /dev/sda1

If you want to play it really safe, backup your data, before confirming and action by answering y to ans question fsck throws at you.