]> git.ipfire.org Git - thirdparty/systemd.git/commit
journald: lower keep_free to 5% and raise min_use to 2% 13120/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 19 Jul 2019 16:42:46 +0000 (18:42 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 26 Jul 2019 14:45:49 +0000 (16:45 +0200)
commit6aae0b1af4fe67b5a80d115fa589897c763ac5f3
treea513a4afdac2a870ee13325d1c971645c289931f
parent170a434c784fc7919e6ad7c269ea4f7abcc6065a
journald: lower keep_free to 5% and raise min_use to 2%

https://bugzilla.redhat.com/show_bug.cgi?id=1715699

> /dev/mapper/live-rw  6.4G  5.7G  648M  91% /
> systemd-journald[905]: Fixed min_use=1.0M max_use=648.7M max_size=81.0M min_size=512.0K keep_free=973.1M n_max_files=100

When journald is started, we pick keep_free as 15% of the disk size. When the
fs is almost filled, we will only keep one journal file around and rotate very
often (because min_size is very small).

Let's set min use to something reasonable, so that we get more useful logs that
will cover at least the full boot.

Some cases considered in the PR:

> /dev/mapper/live-rw 6.4G 5.7G 648M 91% /

keep_free→MIN(327,100)→100 MB.
min_use→16MB.
effective range: 16 MB – 548 MB

> /dev/mapper/fedora_krowka-root 78G 69G 5.7G 93% /

keep_free → MIN(4GB, 100MB)→100MB
min_use→16MB
effective range: 16 MB – 5.6 GB
(but then there's the max_use limit, which cuts the range down)

> 4TB, 4GB free

keep_free → MIN(209715, 100) → 100 MB
min_use→16MB
effective range: 16 MB – 4.9 GB
(also effectively limited by max_use)

Also replace unneeded width suffixes with spaces, I think this is more
readable, and drop DEFAULT_ prefixes in cases where this setting is
simply a bound, and cannot be overridden by user config, hence is not
a default.
src/journal/journal-file.c