UFS2 Journaling implementation detail

Unga unga888 at yahoo.com
Fri Apr 18 12:08:51 UTC 2008

--- Ivan Voras <ivoras at freebsd.org> wrote:

> Unga wrote:
> > Hi all
> > 
> > I'm looking for papers or documentation covering
> > details of the UFS2 Journaling implementation of
> the
> > FreeBSD.
> > 
> > Please give me links to them if you guys know any.
> > 
> > Many thanks in advance.
> There's no such thing as UFS2 Journalling in FreeBSD
> (yet). There's 
> "gjournal" which is journaling on the data layer
> (below the file system, 
> and only with very limited integration with the file
> system). This 
> implementation is not documented (except for usage
> here: 
> but there's a small (and very old) high-level
> overview in my proposal on 
> which the current gjournal is based, here: 
> http://wiki.freebsd.org/gjournal_proposal . Ignore
> the bits about 
> "delay-commit". See also here: 

Ivan, thanks for the links. What I mean is configure
journaling via gjournal(8) for the UFS file system.

I lost some files, specially Firefox's book marks,
history, etc. after a power failure on FreeBSD 7.0.
What else lost is not known yet. I'm looking for a
file system protection mechanism. I understand there
are two mechanism in FreeBSD: Soft Update and

I have following questions in this regard:

1. "Pawel (pjd) has reimplemented gjournal with hooks
in the file system code so it can properly do file
system journaling." -

So, the gjournal is a Journaled File System which can
be used against file system corruptions in the event
of power failure or system crash?

2. "Unfortunately, gjournal cannot replace a
journaling filesystem. At least, a fsck is still
needed on the journaled device/filesystem after a
crash." -(http://wiki.freebsd.org/gjournal)

Is it now confirmed that gjournal does not require
fsck after a power failure or system crash?

3. "To ensure that data is stored on the data
provider, the gjournal sync command should be used
after calling sync(2)." - gjournal(8)

Who should issue this command? user manually?

4. "Size should be chosen based on provider's load,
and not on its size.  It is not recommended to use
gjournal for small file systems" - gjournal(8)

So how do I know what should be the size of the
journal before it is created?

Does it log anywhere if the journal size is too small
for the system load?

5. "Some UFS implementations avoid journaling and
instead implement soft updates: they order their
writes in such a way that the on-disk file system is
never inconsistent, or that the only inconsistency
that can be created in the event of a crash is a
storage leak. To recover from these leaks, the free
space map is reconciled against a full walk of the
file system at next mount." -

So the disadvantage of Soft Update is it is necessary
to run fsck after reboot in event of a crash or power

6. On the same hard disk for various BSD partitions,
is it possible to use both Soft Update and gjournal,
Eg. Soft Update for / , gjournal for /usr?

7. In, gjournal label [-fhv] [-s jsize] dataprov

What is the unit of the size?

Kind regards

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

More information about the freebsd-questions mailing list