Problems with gjournal or something else.

Artem Kuchin matrix at itlegion.ru
Wed Oct 31 11:53:56 PDT 2007


First of all, thank you for replying. It is always very nice and informative
for hear from the actual developer of something. Thank you.

>> Configure gjournaling on an existing file system, but only if gjournal
>> allows this (i.e.: if the last sector is not already used by the file
>> system):
>> 
>> umount /dev/da0s1d
>> gjournal label da0s1d da0s1e
>> tunefs -J enable -n disable 
>> mount -o async /dev/da0s1d.journal /mnt
>> mount /dev/da0s1d /mnt
>> 
>> However, this simple does not work.
>> gjournal label da0s1d da0s1e - WILL FAIL ON EXISTING FS!
>
>Have you read what the warning says? It tells you that the last sector,
>where it tries to write metadata is used by existing file system. Using
>-f option will destroy the last sector. You not only decided to
>overwrite single sector, but 1GB of data, because you didn't give separate
>provider for journal.

My point here is that since it is and example of configuring a gjournaling onf
existing system then this 'gjournal label da0s1d da0s1e' will always fail.
Of course it says the warning, but basically, condidering that it overwrites
last sector+1 GB of data on existing FS there is actual configuring on
existing FS. It is simply destroying it.  

So, i wonder if man page should give such a big hope thar one
can configure gjournal on existing fs. Even if another device is used
for journal the last sector is overwritten and, as i understand, filesystem
still thinks that that sector is free and any attemp to write/read at that
sector will result in error=5

In any case, w/o newfs on .journal special the filesystem does not know
that it is now shorter than before and IO will be attempted out of the
boundaries of that filestem (in the area of journal and last sector) which
will result in error 5. To fix it one must newfs spec.journal wich will
result in loss of data. SO, there is no proper way to maje existing
fs journaled. 

This is totally fine and not a big problem actually, but it should
be mentioned specifically in the man page.

>> Need to use -f switch for this.
>> 
>> So, those whole thing will look like this
>> 
>> 1:  newfs /dev/da0s1d 
>> here we have our  EXISTING filesyetm
>> 2: gjournal load
>> 3: gjournal label -f /dev/da0s1d 
>
>This command destroys 1GB at the end of your file system. How do you
>expect it to work properly after that? Do you think that giving '-f'
>will magically add 1GB to your disk capacity? It won't. It will destroy
>your data, because you asked for by giving *FORCE* option.

>> what does
>> 'mount -o async /dev/da0s1d.journal /mnt || mount /dev/da0s1d /mnt;
>> mean? (note ||)
>
>There is more than that. It is given as one command on purpose. If any
>of the previous commands (gjournal, tunefs or mount) fail, for example
>because it is not possible to convert the file system to use gjournal,
>it will mount the file system back.

I'm sorry. I mean what || means here? I probaly just lack enough shell
knowledge.

>> A couple more questions:
>> 1) What size of  journal to pick?
>2GB is fine.

For any fs size and disk operations intensity? Mine is about 260GB
moderatelly used.

--
Artem


More information about the freebsd-current mailing list