UFS2 Journaling implementation detail
sonicy at otenet.gr
Fri Apr 18 12:22:32 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
>>> 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
>> 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
Funny thing, I am currently writing a tutorial / article on how to
implement gjournal on a desktop PC and I expect to finish the first
version by Monday / Tuesday.
It goes step by step explaining how to implement journaling on /usr (and
possibly /var) when installing FreeBSD 7. I've kept the steps as simple
as possible, so anyone with a basic understanding of FreeBSD and
sysinstall should be able to implement it.
Needless to say I am using journaling on all my 7.0 systems now.
I will be posting a link here and in -doc so that people have a chance
to review it. I hope I can count on your reviews too ;)
More information about the freebsd-questions