Eiko Wagenknecht
Software Developer, Freelancer & Founder

Raspberry Pi - Automatic Filesystem Check and Repair at Boot

Eiko Wagenknecht

Occasionally, the filesystem on a Raspberry Pi (running services like openHAB, Raspberrymatic, or Homebridge) can become damaged. Common causes include power outages or defective SD cards. For minor damage, a simple configuration change can set up automatic filesystem checking and repair during boot.

Table of Contents

Required Materials

Instructions

First, connect to your Raspberry Pi via SSH, for example using Putty.

After logging in, open the file /boot/firmware/cmdline.txt with the nano text editor:

sudo nano /boot/firmware/cmdline.txt

Then add the parameter fsck.mode=force at the end of the line, separated by a space:

That’s it. From now on, the Raspberry Pi will check and repair the filesystem during every boot, before it gets mounted - of course, only if there’s no severe damage.

Conclusion

This simple change can significantly increase the reliability of your Raspberry Pi, especially when it’s used as a home automation hub or for other permanent applications. The automatic filesystem check and repair at boot can address potential issues early, before they lead to more serious errors.

I welcome your comments on whether this post has been helpful to you. Feel free to write if you have questions or if anything remains unclear. Or share your experiences if you’ve been able to implement exciting automation projects building on this tip.

No Comments? No Problem.

This blog doesn't support comments, but your thoughts and questions are always welcome. Reach out through the contact details in the footer below.

Support Me

If you found this page helpful and want to say thanks, I would be very grateful if you could use this link for your next purchase on amazon.com. I get a small commission, and it costs you nothing extra. If you'd like to support me in another way, you can find more options here.