# glabel over gjournal



## franck-porcher (Mar 3, 2012)

Hi there,

I might be missing something but I have not yet figured out how to use glabel(8) on a gjournal(8)'d UFS file system, since both seem to be fighting against each other for possession of the last sector of the disk slice or partition.

In fact, this post is raised after I made what appears to be a booboo x(

I had a perfectly working journaled filesystem (say, da0s1a.journal). Being one of several removable storage, I wanted to give it a comprehensive label for easyness's sake.

Well that was a mistake.

Not knowing whether I should be using either the GEOM provider (da0s1a.journal) or the underlying consumer (da0s1a), I went for the "physical" storage, and ran the following command on the unmounted da0s1a:
`# glabel label -v mylabel /dev/da0s1a`

This worked perfectly fine, and "glabel status" showed in my newly labeled file system. So far, so good !

But gjournal(8) stopped recognizing da0s1a as a journalized file system, and the device /dev/da0s1a.journal simply no longer exists, no matter what I do: unloading/reloading gjournal, detaching/reattaching my removable media.

Therefore my two questions:

(general) How does one go about labeling a g-journaled UFS file system ?
(specific) In my actual situation, as described above, what are my options ? Should I revert to using soft-updates on da0s1, and forget about the journal, or is there a way to get the journal back together (initially set-up on the same slice as the data).

Thank you.
Cheers
Franck


----------



## phoenix (Mar 3, 2012)

You have to layer your GEOM classes from the outside-in, from the generic to the specific.


First, you glabel(8) the disk, creating the /dev/label/mylabel node.
Then you partition the label, creating the /dev/label/mylabel*s1* and /dev/label/mylabels1*a* nodes.
Then you format the partitions.
Then you gjournal(8) the filesystem.

However, since you have already created the UFS filesystem, you don't need to label the entire disk.  Instead, drop to single-user mode, unmount the filesystem, and then use tunefs(8) to add a label directly into the UFS filesystem.  That will create a /dev/ufs/<mylabel node that you can use instead of the raw device node.

Your gjournal(8) setup shouldn't be affected by that, although I have not personally used gjournal(8) so can't vouch for that.


----------



## franck-porcher (Mar 4, 2012)

Thanks Phoenix for your input.

I have used several times glabel and gjournal, but so far never together, whence my initial post after noticing that glabeling my journaled FS crashed my journal!  

Based on my experience with labeling, which never led to any trouble, my understanding was that one could label an existing file-system at any time, either up-front when building the FS, or afterwards, assuming in the later case that the last sector of the media (entire disc, entire slice, or just a partition) is data-free, using either glabel label or *tunefs -L* (by the way, over these two methods, which is the preferred one, and why?).

So that's what I did: I glabeled an existing journaled file-system, only to notice that this action crashed my existing journal. Looking around, I read that both gjournal and glabel were competing for the last sector to write whatever data they need to properly function, which probably is the reason why my journal suddenly disappeared.

Whence my generic question: how to glabel an existing GEOM gjournaled UFS file-system without crashing the journal? And if this is not possible (which is a piece of information I have not stumbled upon so far), why?

Thank you.

Franck P.


----------



## phoenix (Mar 5, 2012)

Remove the journal.

Then label the filesystem (aka, partition).

Finally, journal the label device.

Like I said, you have to layer your GEOM devices. Don't set everything at the same layer.


----------



## kpa (Mar 5, 2012)

When you labeled the provider /dev/da0s1a with glabel(8) you overwrote the metadata written by gjournal(8) because, surprise surprise, you used the SAME provider /dev/da0s1a that the journal used. You could have labeled the journaled provider /dev/da0s1a.journal but I think what Phoenix posted makes more sense.


----------



## chrcol (Apr 26, 2012)

phoenix said:
			
		

> Remove the journal.
> 
> Then label the filesystem (aka, partition).
> 
> ...



I find myself needing to do this one slight problem.

Only ever so slight.

Removing journals isn*'*t documented and no hits on google, any ideas how?

I want to remove my journal so I can readd it to the labeled device.  If I try to stop it then the console gets a looping message about it can*'*t be completed as my drive contains data.

--update--

*T*ried to force the issue by removing the journal filesystem, now as soon as gjournal is loaded I get constant timeout messages, it seems it*'*s stored somewhere the flag, or is it that gjournal is pretty easy to irreversably hose the filesystem and I need to reinstall?


----------



## phoenix (Apr 27, 2012)

Boot to single-user mode, so that your filesystems are mounted read-only, and remove the journals there.

Or, boot off a LiveCD, so that your filesystems aren't mounted at all, and remove the journals there.


----------



## chrcol (Apr 27, 2012)

I am already in single user mode when doing this. I remade the journal partition to stop the constant messages as soon as I run gjournal load but gjournal stop still doesnt work. In addition the partition isn*'*t mounted and I have ran *gjournal sync* first.

I did find this although his isn*'*t exactly the same.

http://freebsd.1045724.n5.nabble.co...ion-fails-on-gpt-labelled-disk-td4923977.html


----------

