Read more

How to check your file system's integrity with fsck

Arne Hartherz
May 07, 2012Software engineer at makandra GmbH

To force a check on your next reboot (here for your root partition), simply:

touch /forcefsck
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

To manually do this, here is how to do it for the first partition on sda, when you are using ext4:

fsck.ext4 -fn /dev/sda1
  • -f forces the check, even if everything seems okay.
  • -n is a "read only" check, where nothing is changed and every question is answered with "no".
  • When using dmcrypt, you probably want to check something like /dev/mapper/lvm-root.

This does not work properly when doing this on mounted devices (i.e. while your system is up), even when using the -n switch.

Kudos to Kim.

Posted by Arne Hartherz to makandra dev (2012-05-07 14:35)