=== Enabling Snapshots on Filesystems Using Journaled Soft Updates

Links: +
link:https://reviews.freebsd.org/D36491[Milestone 1 Core Changes] URL: link:https://reviews.freebsd.org/D36491[https://reviews.freebsd.org/D36491]

Contact: Kirk McKusick <mckusick@FreeBSD.org>

The goal of this project is to make UFS/FFS filesystem snapshots available when running with journaled soft updates.

First a bit of background.
Soft updates have been available for UFS/FFS since the mid 1990s.
They eliminate the need for most synchronous disk writes and keep the state of the filesystem sufficiently consistent that it can be put back online after a crash without the need to run fsck(8).
However, it may incorrectly assume that some of its blocks are still in use when in fact they are free.
So, eventually it is necessary to take the filesystem offline to run fsck(8) to reclaim these lost blocks.
The time to run fsck(8) is a function of the number of files in the filesystem and the size of the filesystem.
Large filesystems may take hours to complete an fsck(8).

Enabling journaling reduces the time spent by fsck(8) cleaning up a filesystem after a crash to a few seconds.
With journaling, the time to recover after a crash is a function of the amount of activity in the filesystem in the minute before the crash.
Journaled recovery time is usually only a few seconds and never exceeds a minute.

The drawback to using journaling is that the writes to its log add an extra write load to the media containing the filesystem.
Thus a write-intensive workload will have reduced throughput on a filesystem running with journaling.

Like all journaling filesystems, the journal recovery will only fix issues known to the journal.
Specifically if a media error occurs, the journal will not know about it and hence will not fix it.
Thus when using journaling, it is still necessary to run a full fsck every few months or after a filesystem panic to check for and fix any errors brought on by media failure.

A full fsck(8) is normally done on an offline filesystem.
However, it can be done by running fsck(8) on a snapshot of a live filesystem.
When running fsck(8) in the background on a live filesystem, the filesystem performance will be about half of normal during the time that the background fsck(8) is running.
Running a full fsck on a UFS filesystem is the equivalent of running a scrub on a ZFS filesystem.

The first milestone of this project has been completed.
It is now possible to take snapshots when running with journaled soft updates and they can be used for doing background dumps on a live filesystem.

The second milestone of this project is to extend fsck(8) to be able to do a background check using a snapshot on a filesystem running with journaled soft updates.
This milestone is expected by Q3 of 2023.

Sponsored by: The FreeBSD Foundation
