From owner-freebsd-questions@FreeBSD.ORG Fri Apr 18 12:22:32 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA2BB1065670 for ; Fri, 18 Apr 2008 12:22:32 +0000 (UTC) (envelope-from sonicy@otenet.gr) Received: from aiolos.otenet.gr (aiolos.otenet.gr [195.170.0.93]) by mx1.freebsd.org (Postfix) with ESMTP id 327E48FC1B for ; Fri, 18 Apr 2008 12:22:31 +0000 (UTC) (envelope-from sonicy@otenet.gr) Received: from [192.168.0.1] (athedsl-156132.home.otenet.gr [85.75.153.130]) by aiolos.otenet.gr (8.13.8/8.13.8/Debian-3) with ESMTP id m3ICMUpu030931; Fri, 18 Apr 2008 15:22:30 +0300 Message-ID: <48089289.3010206@otenet.gr> Date: Fri, 18 Apr 2008 15:22:33 +0300 From: Manolis Kiagias User-Agent: Thunderbird 2.0.0.12 (X11/20080227) MIME-Version: 1.0 To: Unga References: <790871.1688.qm@web57004.mail.re3.yahoo.com> In-Reply-To: <790871.1688.qm@web57004.mail.re3.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org, ivoras@freebsd.org Subject: Re: UFS2 Journaling implementation detail X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2008 12:22:32 -0000 Unga wrote: > --- Ivan Voras 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: >> >> > http://www.freebsd.org/cgi/man.cgi?query=gjournal&manpath=FreeBSD+7.0-RELEASE), > >> 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: >> >> > http://docs.freebsd.org/cgi/getmsg.cgi?fetch=3624+0+/usr/local/www/db/text/2006/freebsd-geom/20060625.freebsd-geom > >> > > 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 > gjournal. > > 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? > > > 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." - > (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? > > > 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 > [jprov] > > What is the unit of the size? > > > Kind regards > Unga > 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 ;)