Index Keywords Recent

↶ Return Home

How to Run a Filesystem Check on Raspberry Pi OS

Last Updated May 3rd 2022, 12:41:16 am

Description

This document outlines how to initiate a filesystem check on Raspberry Pi OS.

Since we cannot run fsck (or e2fsck) on a mounted partiton, we must initiate a filesystem check at boot.

Steps

Open cmdline.txt for editing

sudo edit /boot/cmdline.txt

Add fsck.mode=force to the existing line of text as shown below [1]

1
console=serial0,115200 console=tty1 root=PARTUUID=6c586e13-02 rootfstype=ext4 elevator=deadline fsck.mode=force fsck.repair=yes rootwait

Reboot the system

The filesystem check should be kicked-off as part of the boot process.

Depending on your custom user configuration, the system may require or prompt you to login to a root user session.

At this point you can review the log files.

Check log files

If you want to see the log entries generated, you can use the journalctl tool.

Example [1:1]

$ journalctl -u systemd-fsck*

This shows logs from the specified unit (-u), systemd-fsck*

$ journalctl -xb

This display items related to the current boot (-b) with message explainations where available (-x).


  1. https://raspberrypi.stackexchange.com/questions/111541/output-fsck-on-boot-to-a-log-file ↩︎ ↩︎