loggedfs

2021, Mar 08    

I was working with dovecot and debugging an issue with mbox’s on a read-only media. To debug, I was looking for a way of seeing which files were attempted to be opened and with which permissions.

loggedfs is a fuse filesystem that is designed to be mounted on top of another filesystem, and is a middlelayer, that shows which files are accessed, before it simply redirects the request to the underlying filesystem.

Example on Debian

It is available in bullseye main repository, and may be installed using apt-get install loggedfs.

In the terminal run (as the user of the application)

loggedfs -f /vagrant/testdata/test/mailboxes

it should now show which files are beein accessed, e.g. accessing a readonly mbox using dovecot

$ loggedfs -f /vagrant/testdata/test/mailboxes
2021-03-08 08:39:26,808 INFO [default] LoggedFS not running as a daemon
2021-03-08 08:39:26,809 INFO [default] LoggedFS starting at /vagrant/testdata/test/mailboxes.
2021-03-08 08:39:26,809 INFO [default] chdir to /vagrant/testdata/test/mailboxes
...
2021-03-08 08:39:31,578 INFO [default] getattr /vagrant/testdata/test/mailboxes/2016_mail {SUCCESS} [ pid = 1486 dovecot/imap uid = 1001 ]
2021-03-08 08:39:31,578 INFO [default] getattr /vagrant/testdata/test/mailboxes/2016_mail/mbox {SUCCESS} [ pid = 1486 dovecot/imap uid = 1001 ]
2021-03-08 08:39:31,578 ERROR [default] open readwrite /vagrant/testdata/test/mailboxes/2016_mail/mbox {FAILURE} [ pid = 1486 dovecot/imap uid = 1001 ]
...
2021-03-08 08:39:34,731 INFO [default] LoggedFS closing.

I have omitted a lot of lines that shows that getattr is popular and that it tries to open the file multiple times.

The conclusion is that dovecot opens the mbox in read/write mode and it fails. Whether this is an error or may be handled in the configuration next on the todo list.