From owner-freebsd-questions@FreeBSD.ORG Thu Aug 28 19:26:29 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 19EAC1065674; Thu, 28 Aug 2008 19:26:29 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206045140.chello.pl [87.206.45.140]) by mx1.freebsd.org (Postfix) with ESMTP id 585A68FC29; Thu, 28 Aug 2008 19:26:28 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id D994F45C9B; Thu, 28 Aug 2008 20:59:09 +0200 (CEST) Received: from localhost (chello087206045140.chello.pl [87.206.45.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id C4B23456AB; Thu, 28 Aug 2008 20:59:04 +0200 (CEST) Date: Thu, 28 Aug 2008 20:59:16 +0200 From: Pawel Jakub Dawidek To: Manolis Kiagias Message-ID: <20080828185916.GA2292@garage.freebsd.pl> References: <2b5f066d0808280705y3454c188v768efe46b388864b@mail.gmail.com> <48B6B9D0.8060302@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline In-Reply-To: <48B6B9D0.8060302@gmail.com> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.4 Cc: Brian McCann , freebsd-questions , freebsd-geom@freebsd.org Subject: Re: gjournal & fsck 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: Thu, 28 Aug 2008 19:26:29 -0000 --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 28, 2008 at 05:44:32PM +0300, Manolis Kiagias wrote: > Brian McCann wrote: > >Hi all. I'm having some problems with several servers I've built > >recently (7.0-RELEASE) that are using gjournal. I had two reboot a > >few days ago (un-related to FreeBSD problems I think)...but when they > >came back up, the file systems wouldn't mount since they were not > >clean. Now, I understand that UFS knows nothing about the fact that > >it's journaled, and the journaling knows nothing about UFS...but it's > >my understanding that by using gjournal, you should really never need > >to fsck a file system. However, the only way to get them to mount is > >by doing the fsck. Is there something else I should be doing instead > >of fsck? > > > >And since I know it will probably come up, I built the file systems > >using the instructions and notes at > >http://www.freebsd.org/cgi/man.cgi?query=3Dgjournal&apropos=3D0&sektion= =3D0&manpath=3DFreeBSD+7.0-RELEASE&format=3Dhtml. > > > >Any help would be greatly appreciated! > >Thanks! > >--Brian > > > > =20 >=20 > You may wish to have a look at this article: >=20 > http://www.freebsd.org/doc/en_US.ISO8859-1/articles/gjournal-desktop >=20 > In particular, you should make sure you use tunefs to enable Journaling= =20 > and disable soft update on the journaled filesystems, i.e.: >=20 > tunefs -J enable -n disable /dev/ad0s1f.journal >=20 > Mount them using the async option: >=20 > /dev/ad0s1f.journal /usr ufs rw,async 2 2 >=20 > Note that the pass # still indicates the filesystem should be checked.=20 > While I was writing the article, I was trying several scenarios were I=20 > had the pass # set to 0, thinking that a gjournaled filesystem would not= =20 > need fsck at all. I would then press the reset button. In most cases,=20 > the system would refuse to mount them. However with the pass # set, the= =20 > fsck would finish almost immediately, since the actual consistency check= =20 > takes place when the gjournal module is loaded (you will get a "journal= =20 > consistent" after a bad reboot) and before fstab is even parsed. All=20 > fsck does in this case is simply confirm to the system it is a clean volu= me. >=20 > In short, leaving the pass # to something that would cause an fsck is=20 > the safe way to go. The fsck will be almost instant anyway. Not exactly. Gjournal handles all inconsistencies, except one - orphaned files. An orphaned file is a file that some open, deleted, but haven't closed. If you have panic or power failure at this point, there will be unreferenced file. When fsck detects that it operates on gjournaled file system, it will do a very fast lookup of such orphaned files. It is optimized so that total number of such files is kept in superblock - if this counter is 0, we're done. If it is not zero, then fsck scans only cylinder groups headers, there is another counter in each header says how many orphaned files is in this CG. If CG's counter is 0, the whole CG can be skipped. Once we found X dirty CGs (X is stored in superblock) we can also stop earlier. All in all, there are very few such files (if any), so fsck is way, way faster with gjournal (eg. ~1 minute instead of ~8 hours on huge file system). --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --FCuugMFkClbJLl1L Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFItvWDForvXbEpPzQRAo6kAKD4+K9FKcmJRVYGYTTi0nNaanH9ngCgxOaf ahtll7dsptXXBI9Y3Nh5wwE= =+IBQ -----END PGP SIGNATURE----- --FCuugMFkClbJLl1L--