GJOURNAL(8)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

🌸 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) and fsync(2) system calls do not work as expected anymore. to make sure data is actually stored on the data provider, use the gjournal sync command after calling sync(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 β€” configures gjournal on 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 use gjournal, 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. if gjournal detects that the last sector is used, it will refuse to overwrite it and return an error. this behavior may be forced by using the -f flag, which will force gjournal to overwrite the last sector. > ⚠️ that's the "i know what i'm doing" flag, bestie β€” it overwrites.
  • -h β€” hardcode provider names in metadata.
  • -s jsize β€” 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 use gjournal for 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 β€” see geom(8).
  • status β€” see geom(8).
  • load β€” see geom(8).
  • unload β€” see geom(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: yes
  • switch_time β€” integer, changeable: yes
  • force_switch β€” integer, changeable: yes
  • parallel_flushes β€” integer, changeable: yes
  • accept_immediately β€” integer, changeable: yes
  • parallel_copies β€” integer, changeable: yes
  • record_entries β€” integer, changeable: yes
  • optimize β€” 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 to 0.

πŸ“ 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: no
  • limit β€” integer, changeable: yes
  • divisor β€” integer, changeable: no
  • switch β€” integer, changeable: yes
  • misses β€” integer, changeable: yes
  • alloc_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 of kmem_size. a value of 2 (the default) will cause the cache size to be set to 1/2 of the kmem_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: yes
  • combined_ios β€” integer, changeable: yes
  • switches β€” integer, changeable: yes
  • wait_for_copy β€” integer, changeable: yes
  • journal_full β€” integer, changeable: yes
  • low_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 the low_mem hook 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms