2.Â Understanding Journaling in FreeBSD

The journaling provided by GEOM in FreeBSDÂ 7.X is not file system
specific (unlike for example the ext3 file system in LinuxÂ®) but is
functioning at the block level. Though this means it can be applied
to different file systems, for FreeBSDÂ 7.0-RELEASE, it can only be used
on UFS2.

This functionality is provided by loading the
geom_journal.ko module into the kernel (or
building it into a custom kernel) and using the
gjournal command to configure the file systems.
In general, you would like to journal large file systems, like
/usr. You will need however (see the following
section) to reserve some free disk space.

When a file system is journaled, some disk space is needed to keep
the journal itself. The disk space that holds the actual data is
referred to as the data provider, while the one
that holds the journal is referred to as the
journal provider. The data and journal providers
need to be on different partitions when journaling an existing
(non-empty) partition. When journaling a new partition, you have the
option to use a single provider for both data and journal. In any case,
the gjournal command combines both providers to
create the final journaled file system. For example:

Using gjournal, a new /dev/ad0s1f.journal device is created
where /dev/ad0s1f is the data
provider, and /dev/ad0s1g is
the journal provider. This new device is then used for all
subsequent file operations.

The amount of disk space you need to reserve for the journal
provider depends on the usage load of the file system and not on the
size of the data provider. For example on a typical office desktop,
a 1Â GB journal provider for the /usr file system
will suffice, while a machine that deals with heavy disk I/O (i.e.
video editing) may need more. A kernel panic will occur if the
journal space is exhausted before it has a chance to be
committed.

Note:

The journal sizes suggested here, are highly unlikely to cause
problems in typical desktop use (such as web browsing, word
processing and playback of media files). If your workload
includes intense disk activity, use the following rule for maximum
reliability: Your RAM size should fit in 30% of the journal provider's
space. For example, if your system has 1Â GB RAM, create an
approximately 3.3Â GB journal provider. (Multiply your
RAM size with 3.3 to obtain the size of the journal).

For more information about journaling, please read the manual
page of gjournal(8).