From owner-freebsd-questions@FreeBSD.ORG Fri Apr 18 16:05:27 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 9C5A41065673 for ; Fri, 18 Apr 2008 16:05:27 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.238]) by mx1.freebsd.org (Postfix) with ESMTP id 456158FC1F for ; Fri, 18 Apr 2008 16:05:27 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: by wr-out-0506.google.com with SMTP id 50so386283wra.13 for ; Fri, 18 Apr 2008 09:05:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=kXGoBfEUvDUKrRjOlc0u6n7R4olZYrF1lSXSaPfCOBs=; b=weFbhsrMw0nnCyvtB+mHNmCH7puowKyOOZW+bVzML7CFbnbzdBwk6rnvuw0Cxz+LSwSWXA8KjaQvwUS16Zee23FnuONTHBhL4AOnlsi5m23vzI19oS5wuwcnhgE+NMiYB5zlXcBBQ/ytWwgKjeOiioCZuJiPL95QlsdI+L9Cci4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=BIsBym7Fm8w2NSww0CTZjJWvY5fKL8sOEKy9XNyYV23uRzq6G8+bkuq3ClcW2jL/MozFUONPFQCzq1yPUw1nvxLz5hAdA+wTIjSDtxez7rzExCDfLlLglclwp6UWhQEy1f4KmYO4TzYK0bUMhJiYhc0ObMdjxBIbYDBaabd/L08= Received: by 10.140.251.1 with SMTP id y1mr1622994rvh.11.1208533204380; Fri, 18 Apr 2008 08:40:04 -0700 (PDT) Received: by 10.141.212.1 with HTTP; Fri, 18 Apr 2008 08:40:04 -0700 (PDT) Message-ID: <9bbcef730804180840y77adff73x7ad0cf90c82633a9@mail.gmail.com> Date: Fri, 18 Apr 2008 17:40:04 +0200 From: "Ivan Voras" Sender: ivoras@gmail.com To: Unga In-Reply-To: <790871.1688.qm@web57004.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <790871.1688.qm@web57004.mail.re3.yahoo.com> X-Google-Sender-Auth: c9455817199867b4 Cc: freebsd-questions@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 16:05:27 -0000 > 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.