Fsck in the Background
Marshall Kirk McKusick
Traditionally, recovery of the BSD fast filesystem after an
uncontrolled system crash such as power failure or system
panic required the use of the filesystem checking program,
fsck. Because the filesystem cannot be modified during the
time that it is being checked by fsck, a large server may
experience unacceptably long periods of downtime after a
crash. To create an apparently quiescent filesystem, snapshots
of a filesystem partition were added. To reduce the number
and types of corruption, soft updates were added to ensure
that the only filesystem inconsistencies are lost resources.
With these two additions it is now possible to run fsck on an
active filesystem. Background fsck runs by taking a snapshot
then running its traditional first four passes to calculate the
correct bitmaps for the allocations in the filesystem snapshot.
From these bitmaps, it determines the lost resources and does
a set of system calls to release them back into the bitmaps for
the underlying active filesyst.