gjournal: journaled slices vs. journaled partitions

Volodymyr Kostyrko c.kworr at gmail.com
Tue Nov 4 07:43:07 PST 2008

Carl wrote:
> Volodymyr Kostyrko wrote:
>> I have some setups were gjournal was put on device rather the on 
>> partition, i.e.:
>> [umgah] ~> gmirror status
>>           Name    Status  Components
>> mirror/umgah0  COMPLETE  ad0
>>                           ad1
>> [umgah] ~> gjournal status
>>                   Name  Status  Components
>> mirror/umgah0.journal     N/A  mirror/umgah0
>> [umgah] ~> glabel status
>>              Name  Status  Components
>>    ufs/umgah0root     N/A  mirror/umgah0.journala
>> label/umgah0swap     N/A  mirror/umgah0.journalb
>>     ufs/umgah0usr     N/A  mirror/umgah0.journald
>>     ufs/umgah0var     N/A  mirror/umgah0.journale
> Does the above suggest that you've ended up with individual journal 
> providers for each partition anyway? If so, where are they and have you 
> really achieved anything functionally different? Are they at the end of 
> their individually associated partitions or all together somewhere else? 
> Has the ill-advised journaled small partition issue been successfully 
> overcome through what you've done?

First, there is only one journal - for /dev/mirror/umgah0 and it is 
named /dev/mirror/umgah0.journal. Anything else is just a bsdlabel 
partitions, there are four of 'em.

>> [umgah] ~> mount
>> /dev/ufs/umgah0root on / (ufs, asynchronous, local, noatime, gjournal)
>> devfs on /dev (devfs, local)
>> /dev/md0 on /tmp (ufs, asynchronous, local)
>> /dev/ufs/umgah0var on /var (ufs, asynchronous, local, noatime, gjournal)
>> /dev/ufs/umgah0usr on /usr (ufs, asynchronous, local, noatime, gjournal)
>> devfs on /var/named/dev (devfs, local)
>> And yes, mirror autosynchronization is turned off, gjournal takes care 
>> of that too.
>> It's not stated in manual, but gjournal is typically transparent for 
>> any type of access, just in case of UFS file system is marked as 
>> journaled so any metadata writes can be distinguished from data 
>> writes. Without that gjournal does literally nothing.
> And what does this mean for your swap partition?

Just nothing, it's just swap. It can't be journaled.

> Laszlo Nagy wrote earlier:
>> Another tricky question: why would you journal a SWAP partition?
> Volodymyr, does your assertion that gjournal does nothing when a file 
> system is not UFS mean that there is no penalty with regard to your swap 
> partition despite the existence of "mirror/umgah0.journalb"?

I haven't seen any perfomance decrease in this configuration. And 
according to manual and articles about gjournal it should work this way.

> Any chance you'd like to share your command sequence for constructing 
> your gmirror'd and gjournal'd filesystem, Volodymyr? :-)

If we have two disks (ad0, ad1) it should look like this:

 > gmirror label -b load -n umgah0 ad1

We are getting all drive gmirrored without synchronization (we don't 
need it - journal would take care of any discrepancies) and with load 
balance (load was fixed not so long ago in stable and should be fine to 
go with).

 > gjournal label mirror/umgah0

We are creating a journal on top of our gmirror. It eats 1G from the end 
of the disks and gives us the rest to use.

 > bsdlabel -wB mirror/umgah0.journal

We are writing the standard bsdlabel to the disk and making it bootable. 
After that we will get one partition 'a'.

Yes, no fdisk. I don't think this old piece of rough junk is ever needed 
on machine running FreeBSD solely. It just takes space, it requires 
compatibility to forgotten-and-abandoned standards and gives nothing 
more. You have your server dual-booting Windows or Linux? This is the 
only case you need fdisk for.

 > bsdlabel -e mirror/umgah0.journal

Now we are splitting our journal to some partitions. I did it this way:

# /dev/mirror/umgah0.journal:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
   a:   524288       16    4.2BSD
   b: 16777216   *      swap
   c: 779325614        0    unused        0     0         # "raw" part, 
don't edit
   d: 33554432 *    4.2BSD
   e: * *    4.2BSD

After that we can format this filesystems:

 > newfs -J -L umgah0root /dev/mirror/umgah0.journala
 > newfs -J -L umgah0var /dev/mirror/umgah0.journald
 > newfs -J -L umgah0usr /dev/mirror/umgah0.journale

And label the swap:

 > glabel label umgah0swap /dev/mirror/umgah0.journalb

You can skip all this glabel thing, I just prefer to have slim fstab, as 
slim as possible.

/dev/label/umgah0swap none swap sw 0 0

md /tmp mfs rw,-s1024m,-S,-oasync 0 0

/dev/ufs/umgah0root / ufs rw,async,noatime 0 1
/dev/ufs/umgah0var /var ufs rw,async,noatime 0 2
/dev/ufs/umgah0usr /usr ufs rw,async,noatime 0 2

There's a lot more here to describe from moving system to newly created 
partitions to inserting and rebuilding our first disk to gmirror. All 
this issues are described in handbook or other articles found on the net.

Sphinx of black quartz judge my vow.

More information about the freebsd-questions mailing list