AutoFsck - Technical Review

Krzysztof Lichota krzysiek at
Fri Aug 15 12:18:44 BST 2008

2008/8/12 Scott James Remnant <scott at>:
> (Originally posted to the Technical Board, 20th Feburary)
> On the train home this evening I was able to perform a detailed
> technical review of Jonathan Musther's AutoFsck specification and
> implementation.
> I was surprised to discover that AutoFsck actually doesn't check the
> filesystems on shutdown; it reboots your computer and then performs the
> check on startup, before shutting down your computer again.
> There are a myriad of obvious problems with this approach; the major two
> being dual boot scenarios and kernel upgrades.
> A non-default option exists to do it after the filesystems are remounted
> read-only, and I would be interested to find out from the author what
> problems they encountered.

I am not the author of AutoFsck, but I can tell what is the problem
based on my work on defrag-upon-shutdown for Prefetch.

The problem is that if you start changing on-disk data while
filesystem is mounted read-only, FS code might re-read the data from
disk (at any moment) and as it is inconsistent with other data on disk
and with in-memory structures, it might cause oops due to consistency
check.The chance is small, but it exists. It can be alleviated by
trying to cache everything in memory beforehand, but it is also not
100% sure way, filesystem can spawn some time-based events.

I have hit the same problem. I wanted to unmount the root partition
(by doing pivot_root trickery), but I couldn't make it work. If
someone knows how to do it, I would be very interested in the

One other possible solution would be to reboot using kexec into
minimal kernel+initrd to do fsck and then do proper shutdown/reboot.



	Krzysztof Lichota

More information about the ubuntu-devel mailing list