Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Sep 2008 05:46:17 +0200
From:      "fluffles.net" <bsd@fluffles.net>
To:        Andrei Kolu <antik@bsd.ee>
Cc:        freebsd-geom@freebsd.org
Subject:   Re: gjournal misconfiguration
Message-ID:  <48D5C389.6040209@fluffles.net>
In-Reply-To: <200805211121.53354.antik@bsd.ee>
References:  <200805201423.56220.antik@bsd.ee> <4832D989.60607@quip.cz> <200805211121.53354.antik@bsd.ee>

next in thread | previous in thread | raw e-mail | index | archive | help
Andrei Kolu wrote:
>>> I created geom journal according to this documentation:
>>> http://www.freebsd.org/doc/en/books/handbook/geom-gjournal.html
>>>
>>> I already had partition on second drive (da1s1d)
>>>       

> to me: /dev/da1s1d.journal == /dev/da1s1.journald 
>
> does it make any sense?
>   

Hi Andrei!

After some puzzling i realised that your issues with two names for your
journal can actually make sense. If my theory is correct, the last
sector of da1s1d and da1s1 are the same physical location on disk.
Meaning that the d-parition covers the whole /dev/da1s1 device without
leaving space for the metasector geom_journal needs. You then created a
gjournal on it, warning you of an existing filesystem. You may have
thought "i don't need this filesystem anymore" and disregarded the
warning. The journal works, but now *two* journals are detected: one on
the da1s1 device and one on the da1s1d device, since they both point to
the same physical location where gjournal stores its data. So your
problem is - i think - actually a partitioning problem, causing unwanted
behavior.

If you want to use BSD partitions or disklabels (a,d,e,f suffix) you
should have labeled /dev/da1s1.journal and NOT /dev/da1s1 which you
probably did. I guess you first created /dev/da1s1, then created bsd
partitions on it and got /dev/da1s1d and then created a geom_journal on
/dev/da1s1d. Geoms work like a container in a container. The
/dev/da1s1.journal device (when used with seperate journal storage) is
one sector smaller than the underlying /dev/da1s1 device. This keeps the
metadata seperate, you can stack geom modules on top of eachother. In
your procedure, you have 'violated' the sovereignty of the /dev/da1s1d
device probably when you created this d-label, which points to the same
last sector as /dev/da1s1. To use journaling on /dev/da1s1d, you should
have made /dev/da1s1d at least one sector smaller, when using "bsdlabel
-e /dev/da1s1". Then you would have had no problems, only a little lower
performance due to stripe misalignment.

You should definately resolve this. Here's my suggestion, but it causes
all loss of data on the da1 device:

First, unmount everything similar to /dev/da1, then:

# unload kernel module (important!)
kldunload geom_journal
# check geom_journal is unloaded
kldstat
# clear gjournal metasector
gjournal clear /dev/da1
gjournal clear /dev/da1s1
gjournal clear /dev/da1s1d
# clear all disklabels
dd if=/dev/zero of=/dev/da1 bs=1m count=1
# load gjournal
gjournal load
# create geom_journal device on /dev/da1s1 and using /dev/da1s2 as
journal storage:
gjournal label /dev/da1s1 /dev/das2

A second option would be to use /dev/da1 in Dangerously Dedicated mode,
my favorite, causing other operating systems than FreeBSD to see only
junk on the drive and overwrite with a partition table, like Windows
does with its "Initialize disk?" question, people click yes and gone is
your precious first 20MB of data :) For FreeBSD it works fine though.
The advantage is higher performance because you do not have a
misalignment anymore, aside from the 64KiB offset UFS2 is hardcoded to.
This second option would look like on of these:

gjournal label /dev/da1
# OR:
gjournal label /dev/da1 /dev/some/other/journal/storage/provider

After this step you have /dev/da1.journal or /dev/da1s1.journal
depending on the choice you made. Now just apply a filesystem:
newfs -J /dev/da1s1.journal

and mount using async and optionally noatime:
mount -o async,noatime /dev/da1.journal /mnt
(change da1 to da1s1 if applicable)

And you're done basically. If you really want, you can create labels
like /dev/da1s1.journala and /dev/da1s1.journalb - note the last letter
indicates the bsd partition/disklabel. Personally i recommend you use DD
mode (/dev/da1.journal as filesystem) unless you have good reason not to.

You can't do this procedure if this is your system disk, ofcourse. I
assume it is not.

Regards,
Veronica



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