Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jun 2006 18:52:50 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-fs@FreeBSD.ORG
Subject:   Re: Journaling UFS with gjournal.
Message-ID:  <200606231652.k5NGqoQ0023670@lurza.secnetix.de>
In-Reply-To: <20060623083838.86539.qmail@web30308.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
R. B. Riddick <arne_woerner@yahoo.com> wrote:
 > Alexandr Kovalenko <never@nevermind.kiev.ua> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606231652.k5NGqoQ0023670>