1

I would like to store the default journal directory /var/log/journal/ on a mounted device, but I am not sure if I can do it due to the fact that journal is an important service which may already run before any device is mounted which would lead to the fact that suddenly the directly changes.

Is it safe/possible to store the journal directory on a mounted device and if yes, how to do it, if a simple mounting doesn't work.

Directory listing from the journal entries:

2019-03-18 22:16:41 root@AAEB-APP206LY:/var/log/journal/d41cf15550e34487abe7103b61fbf794 => ll
total 792M
drwxr-sr-x  1 root systemd-journal  884 Mar 12 06:35 ./
drwxr-sr-x  1 root systemd-journal   64 Feb 26 18:17 ../
-rw-r-----  1 root systemd-journal  96M Mar 18 22:16 system.journal
-rw-r-----  1 root root            120M Feb 26 18:17 system@d5301574c947425cb992f7839ae52cdb-0000000000000001-0005827c7effc14d.journal
-rw-r-----  1 root systemd-journal  96M Mar  5 12:29 system@d5301574c947425cb992f7839ae52cdb-0000000000051acb-000582cf3a7ba719.journal
-rw-r-----  1 root systemd-journal  96M Mar 12 06:35 system@d5301574c947425cb992f7839ae52cdb-00000000000872b4-000583572e31154d.journal
-rw-r-----+ 1 root systemd-journal 128M Mar 18 22:16 user-5000.journal
-rw-r-----+ 1 root root            128M Mar  5 12:29 user-5000@cf6acecdf28e48c790173a36447ec2e7-0000000000051ad9-000582cf3d435013.journal
-rw-r-----+ 1 root systemd-journal 128M Mar 12 06:35 user-5000@cf6acecdf28e48c790173a36447ec2e7-00000000000872b9-000583572e312040.journal

As you can see it is occupying almost 800 MB and this fills up the main partition. Therefore the idea to store it on a different filesystem.

  • You do not mean "on a mounted device". After all, all such filesystems are mounted, even the / filesystem. You mean "on some filesystem other than my / filesystem". – JdeBP Mar 18 at 15:43
  • @JdeBP Yes, reading your comment I realize I described it wrong. You are right. I mean this. Does it change anything and you could answer my question? – Al Bundy Mar 18 at 18:22
  • Are journal stored in inodes not in folders? I am a bit confused. Is this ext4? – Luciano Andress Martini Mar 18 at 20:35
  • Right. That is not related to file system journal (as far as I know) but only to systemd init system. Is that still ok for you? – Luciano Andress Martini Mar 19 at 12:07
0

From the systemd-journald manual page:

The journal service stores log data either persistently below /var/log/journal or in a volatile way below /run/log/journal/ (in the latter case it is lost at reboot). By default, log data is stored persistently if /var/log/journal/ exists during boot, with an implicit fallback to volatile storage otherwise. Use Storage= in journald.conf(5) to configure where log data is placed, independently of the existence of /var/log/journal/.

So it is possible and safe to store the journal at some other place. You will just have to add/change

Storage=/some-filesystem-with-free-space/some-dir/

in one of the journald configuration files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.