Keeping KMail's Auxiliary Storage Areas Clean

KMail stores data in several different places on your machine. Most of these places are inside the ~/.local/share/ directory somewhere. For instance, on most Linux distros, your Local Folders are in ~/.local/share/local-mail/ . Akonadi stores most of its data in ~/.local/share/akonadi/ .

~ $ cd .local/share/akonadi
~/.local/share/akonadi $ ls
Akonadi.error      db_data  file_db_data     mysql.conf  socket-localhost-default
Akonadi.error.old  db_misc  file_lost+found  search_db

Akonadi.error and Akonadi.error.old are log files that are created whenever Akonadi stops and restarts. Text file mysql.conf is a configuration file for the mysqld daemon that serves as Akonadi's backend. The two directories db_data and search_db contain the actual mysql database tables. There are also a couple of mysql log files in db_data that might be helpful if and when Akonadi acts up.

The two directories file_db_data and file_lost+found contain auxiliary data associated with asynchronous processing. Akonadi does not automatically clean out the file_lost+found directory, so you may wish to clean those files up manually from time to time (e.g., with Dolphin). Akonadi does try to clean the file_db_data directory out after it has merged everything into the main database files, but sometimes junk piles up in there. Use this command

find .local/share/akonadi/file_db_data/ -type f | xargs rm

to fix this when it happens. (If the directory file_db_data is already clean, the "find" command shown above will return an error.)