#StackBounty: #boot #fsck How to force fix file systems during boot

Bounty: 50

I have two disks, at / and /home/ and both show errors with fsck.ext4 -fn /dev/<disk>. (-f = check even if ‘clean’, -n = read-only mode)

How can I fix these file-system errors?

I managed to enable boot-time scanning (unsure if it scans both), but afterwards both disks still give errors.


Details

I followed the guide at https://linuxconfig.org/how-to-force-fsck-to-check-filesystem-after-system-reboot-on-linux and the method with the touch file didn’t work even for the root disk. Ubuntu complains:

Feb 11 17:11:02 mark systemd-fsck[690]: Please pass ‘fsck.mode=force’ on the kernel command line rather than creating /forcefsck on the root file system.

I tried the second option on both disks, editing /etc/fstab to set the result code to 2 and executing tune2fs -c 1 /dev/disk for both disks. Since the, during every boot I see:

Press Ctrl+C to cancel all filesystem checks in progress
Checking in progress on 1 disk (26.0% completed)

It shows 1 disk (I expected two). It starts at 26% and goes up to (almost) 100%.

After logging in, when I execute fsck.ext4 on both disks, I still find multiple errors, like orphaned inodes, wrong free node count, zero dtime inodes, block bitmap differences, etc.

How can I fix the errors I find with fsck.ext4, during boot-time?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.