From owner-freebsd-fs@FreeBSD.ORG Fri Jun 23 16:53:00 2006 Return-Path: X-Original-To: freebsd-fs@FreeBSD.ORG Delivered-To: freebsd-fs@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5513216A47B for ; Fri, 23 Jun 2006 16:53:00 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 791AF43D58 for ; Fri, 23 Jun 2006 16:52:57 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (ufwdix@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k5NGqoKl023671 for ; Fri, 23 Jun 2006 18:52:56 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k5NGqoQ0023670; Fri, 23 Jun 2006 18:52:50 +0200 (CEST) (envelope-from olli) Date: Fri, 23 Jun 2006 18:52:50 +0200 (CEST) Message-Id: <200606231652.k5NGqoQ0023670@lurza.secnetix.de> From: Oliver Fromme To: freebsd-fs@FreeBSD.ORG In-Reply-To: <20060623083838.86539.qmail@web30308.mail.mud.yahoo.com> X-Newsgroups: list.freebsd-fs User-Agent: tin/1.8.0-20051224 ("Ronay") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 23 Jun 2006 18:52:56 +0200 (CEST) Cc: Subject: Re: Journaling UFS with gjournal. X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-fs@FreeBSD.ORG List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jun 2006 16:53:00 -0000 R. B. Riddick wrote: > Alexandr Kovalenko wrote: > > Is it safe to do so on existing filesystem (if I'm using 2nd partition for > > journal)? > > Depends: > If your existing file system needs its last sector, then it wont work. If it > does not need it, then it might work (although fsck does not check for a > raw-device shrinkage - I think)... It has no way to check it. If the last sector of the partition happens to be part of file data, overwriting it with gjournal meta data will lead to a corrupted file, and fsck(8) has no way to notice that, of course. If that sector happens to contain UFS meta data, fsck(8) might detect the corruption and try to correct it, which will destroy the gjournal meta data. I guess that both cases are very, very bad. :-) It's not difficult to check if the last sector is in use or not. Just repeat the newfs(8) with the -N flag, so it prints out the values without doing anything (you can even do this as normal user, not root). For example: $ bsdlabel /dev/ad0s1 | grep a: a: 488397105 0 4.2BSD 2048 16384 106 # (Cyl. 0 - 484520*) $ newfs -N /dev/ad0s1a Warning: Block size and bytes per inode restrict cylinders per group to 89. Warning: 1744 sector(s) in last cylinder unallocated /dev/ad0s1a: 488397104 sectors in 119238 cylinders of 1 tracks, 4096 sectors 238475.1MB in 1340 cyl groups (89 c/g, 178.00MB/g, 22528 i/g) In that case, the last sector is not used by the file system. (Of course, if you created the FS with special options, e.g. different cylinder group size, you must specify those options here, too, or you might get wrong output.) FreeBSD does have growfs(8), but unfortunately it still doesn't have shrinkfs(8), which other operating systems have (e.g. Solaris). It might be a nice project for a junior FS hacker ... ;-) Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "... there are two ways of constructing a software design: One way is to make it so simple that there are _obviously_ no deficiencies and the other way is to make it so complicated that there are no _obvious_ deficiencies." -- C.A.R. Hoare, ACM Turing Award Lecture, 1980