GJOURNAL(8)
πΈ gjournal(8) β from the System Manager's Manual πΈ
okay bestie, buckle up β this is the manual page for gjournal, the control utility for journaled devices. it's a little retro, a little powerful, and honestly kind of iconic once you get it. let's go π
β¨ NAME β¨
gjournal β control utility for journaled devices π
β¨ SYNOPSIS β¨
gjournal label [-cfhv] [-s jsize] dataprov [jprov]
gjournal stop [-fv] name ...
gjournal sync [-v]
gjournal clear [-v] prov ...
gjournal dump prov ...
gjournal list
gjournal status
gjournal load
gjournal unload
π¦ DESCRIPTION π¦
so, gjournal is the utility you use for journal configuration on a given GEOM provider. the journal and the data can live on the same provider or on two separate providers β your call, no pressure π«Ά
this is block level journaling, not file-system-level journaling, which means everything gets logged. like, for file systems, it journals both data and metadata. the gjournal GEOM class can talk to file systems, which is what lets you use gjournal for file system journaling and to keep file systems in a consistent state. at this time, only UFS file system is supported β so that's the vibe check for now.
to configure journaling on the UFS file system using gjournal, you should first create a gjournal provider using the gjournal utility, then run newfs(8) or tunefs(8) on it with the -J flag, which instructs UFS to cooperate with the gjournal provider underneath. β¨
β οΈ there are important differences in how journaled UFS works. the most important one:sync(2)andfsync(2)system calls do not work as expected anymore. to make sure data is actually stored on the data provider, use thegjournal synccommand after callingsync(2). seriously. don't skip it π
for the best performance possible, soft-updates should be disabled when gjournal is used. it's also safe and recommended to use the async mount(8) option π
when gjournal is configured on top of gmirror(8) or graid3(8) providers, it also keeps them in a consistent state, so automatic synchronization on power failure or system crash may be disabled on those providers. one less thing to worry about, slay π
the gjournal utility uses on-disk metadata, stored in the provider's last sector, to store all needed information. which could be a problem when an existing file system is converted to use gjournal β just, heads up π«
the first argument to gjournal indicates an action to be performed:
labelβ configuresgjournalon the given provider(s). if only one provider is given, both data and journal are stored on the same provider. if two providers are given, the first one will be used as the data provider and the second will be used as the journal provider. πΎ
additional options include:
-cβ checksum journal records.-fβ may be used to convert an existing file system to usegjournal, but only if the journal will be configured on a separate provider and if the last sector in the data provider is not used by the existing file system. ifgjournaldetects that the last sector is used, it will refuse to overwrite it and return an error. this behavior may be forced by using the-fflag, which will forcegjournalto overwrite the last sector. > β οΈ that's the "i know what i'm doing" flag, bestie β it overwrites.-hβ hardcode provider names in metadata.-sjsizeβ specifies size of the journal if only one provider is used for both data and journal. the default is one gigabyte. size should be chosen based on the provider's load, and not on its size β recommended minimum is twice the size of the physical memory installed. it is not recommended to usegjournalfor small file systems (e.g.: only few gigabytes big). π
clearβ clear metadata on the given providers.stopβ stop the given provider.
additional options include:
-fβ stop the given provider even if it is opened.
syncβ trigger journal switch and enforce sending data to the data provider. π₯dumpβ dump metadata stored on the given providers.listβ seegeom(8).statusβ seegeom(8).loadβ seegeom(8).unloadβ seegeom(8).
additional options include:
-vβ be more verbose. π£οΈ
π EXIT STATUS π
exit status is 0 on success, and 1 if the command fails. simple as that β¨
π EXAMPLES π
create a gjournal based UFS file system and mount it β the classic little ritual:
gjournal load
gjournal label da0
newfs -J /dev/da0.journal
mount -o async /dev/da0.journal /mnt
configure journaling 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) β note the || fallback, she's prepared π
:
umount /dev/da0s1d
gjournal label da0s1d da0s1e && \
tunefs -J enable -n disable da0s1d.journal && \
mount -o async /dev/da0s1d.journal /mnt || \
mount /dev/da0s1d /mnt
π§ SYSCTLS π§
gjournal adds the sysctl level kern.geom.journal. the string and integer information available is detailed below. the changeable column shows whether a process with appropriate privilege may change the value. π
the top-level ones, in all their glory:
debugβ integer, changeable: yesswitch_timeβ integer, changeable: yesforce_switchβ integer, changeable: yesparallel_flushesβ integer, changeable: yesaccept_immediatelyβ integer, changeable: yesparallel_copiesβ integer, changeable: yesrecord_entriesβ integer, changeable: yesoptimizeβ integer, changeable: yes
what they actually do, bestie:
debugβ setting a non-zero value enables debugging at various levels. debug level 1 will record actions at a journal level, relating to journal switches, metadata updates, etc. debug level 2 will record actions at a higher level, relating to the numbers of entries in journals, access requests, etc. debug level 3 will record verbose detail, including insertion of I/Os to the journal. πswitch_timeβ the maximum number of seconds a journal is allowed to remain open before switching to a new journal.force_switchβ force a journal switch when the journal uses more than N% of the free journal space.parallel_flushesβ the number of flush I/O requests to be sent in parallel when flushing the journal to the data provider.accept_immediatelyβ the maximum number of I/O requests accepted at the same time.parallel_copiesβ the number of copy I/O requests to send in parallel.record_entriesβ the maximum number of record entries to allow in a single journal.optimizeβ controls whether entries in a journal will be optimized by combining overlapping I/Os into a single I/O and reordering the entries in a journal. this can be disabled by setting the sysctl to0.
π cache
the string and integer information available for the cache level is detailed below. the changeable column shows whether a process with appropriate privilege may change the value.
usedβ integer, changeable: nolimitβ integer, changeable: yesdivisorβ integer, changeable: noswitchβ integer, changeable: yesmissesβ integer, changeable: yesalloc_failuresβ integer, changeable: yes
and the meanings:
usedβ the number of bytes currently allocated to the cache.limitβ the maximum number of bytes to be allocated to the cache.divisorβ sets the cache size to be used as a proportion ofkmem_size. a value of2(the default) will cause the cache size to be set to1/2of thekmem_size.switchβ force a journal switch when this percentage of cache has been used.missesβ the number of cache misses, when data has been read, but was not found in the cache.alloc_failuresβ the number of times memory failed to be allocated to the cache because the cache limit was hit.
β stats
the string and integer information available for the statistics level is detailed below. the changeable column shows whether a process with appropriate privilege may change the value.
skipped_bytesβ integer, changeable: yescombined_iosβ integer, changeable: yesswitchesβ integer, changeable: yeswait_for_copyβ integer, changeable: yesjournal_fullβ integer, changeable: yeslow_memβ integer, changeable: yes
the receipts π:
skipped_bytesβ the number of bytes skipped.combined_iosβ the number of I/Os which were combined by journal optimization.switchesβ the number of journal switches.wait_for_copyβ the number of times the journal switch process had to wait for the previous journal copy to complete.journal_fullβ the number of times the journal was almost full, forcing a journal switch.low_memβ the number of times thelow_memhook was called.
π SEE ALSO π
geom(4), geom(8), mount(8), newfs(8), tunefs(8), umount(8) β go read these too, iykyk π
π HISTORY π
the gjournal utility appeared in FreeBSD 7.0. a legend was born β¨
π«Ά AUTHORS π«Ά
Pawel Jakub Dawidek <pjd@FreeBSD.org> β ty for your service, king π
and that's the whole page, bestie! this one's from the Debian build, dated February 17, 2009 β vintage but still serving π β¨ go journal something responsibly π¦
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 2006-2009 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms