UFS2 Journaling implementation detail
Ivan Voras
ivoras at freebsd.org
Fri Apr 18 16:05:27 UTC 2008
> Ivan, thanks for the links. What I mean is configure
> journaling via gjournal(8) for the UFS file system.
Just follow the example in gjournal(8) :)
> 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." -
> http://wiki.freebsd.org/gjournal)
>
> 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?
No, gjournal is a layer below the file system (think of it as a
virtual disk drive) that does journalling. You need to create a file
system on top of gjournal. Pawel added some necessary integration for
UFS.
> 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?
Yes, this is old information. The current gjournal implementation
works without fsck.
> 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?
I don't think so. I think this is also old information. There are some
hard drives and controller that don't support BIO_FLUSH (which could
theoretically need the above commands) but you are notified about
these drives on boot.
> 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?
Theoretically, there's a fairly complex calculation based on your disk
drive capacity and journal delay time, but unless you are using fast
server-class drive, 1 GB should be enough for the journal.
> Does it log anywhere if the journal size is too small
> for the system load?
Yes, you'll get a system panic in this case. Yes, it's a bad solution,
complain to Pawel :)
> 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." -
> (http://en.wikipedia.org/wiki/Journaling_file_system)
>
> So the disadvantage of Soft Update is it is necessary
> to run fsck after reboot in event of a crash or power
> failure?
Yes. The advantage is that practically, the data is as safe as with journalling.
> 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?
Yes, but it doesn't make much sense to do it this way. It won't crash
but there are no benefits to it.
Note also that you can't add a gjournal-supported journal on existing
file systems without using external journals. In other words: if you
already created all your file systems and don't have any free space on
the drive to create additional partitions, you can't use gjournal.
> 7. In, gjournal label [-fhv] [-s jsize] dataprov
> [jprov]
>
> What is the unit of the size?
Whatever you want it to be, for example "1M" means megabyte.
More information about the freebsd-questions
mailing list