On 2017-04-28 18:16, Chris Murphy wrote: > Old news is that systemd-journald journals end up pretty heavily > fragmented on Btrfs due to COW. While journald uses chattr +C on > journal files now, COW still happens if the subvolume the journal is > in gets snapshot. e.g. a week old system.journal has 19000+ extents. > > The news is I started a systemd thread. > > This is the start: > https://lists.freedesktop.org/archives/systemd-devel/2017-April/038724.html > > Where it gets interesting, two messages by Andrei Borzenkov: He > evaluates existing code and does some tests on ext4 and XFS. > https://lists.freedesktop.org/archives/systemd-devel/2017-April/038724.html > https://lists.freedesktop.org/archives/systemd-devel/2017-April/038728.html > > And then the question. > https://lists.freedesktop.org/archives/systemd-devel/2017-April/038735.html > > Given what journald is doing, is what Btrfs is doing expected? Is > there something it could do better to be more like ext4 and XFS in the > same situation? Or is it out of scope for Btrfs?
In the past I faced the same problems; I collected some data here http://kreijack.blogspot.it/2014/06/btrfs-and-systemd-journal.html. Unfortunately the journald files are very bad, because first the data is written (appended), then the index fields are updated. Unfortunately these indexes are near after the last write . So fragmentation is unavoidable. After some thinking I adopted a different strategies: I used journald as collector, then I forward all the log to rsyslogd, which used a "log append" format. Journald never write on the root filesystem, only in tmp. The think became interesting when I discovered that the searching in a rsyslog file is faster than journalctl (on a rotational media). Unfortunately I don't have any data to support this. However if someone is interested I can share more details. BR G.Baroncelli -- gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it> Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html