How to clean Akonadi

I’m trying to cleanup my somewhat messy Home partition,and by analyzing it I noticed that the ~/.local/share/akonadi folder is a bit heavy: it is 3,8 GB and contains nearly 19000 files. I don’t know what its supposed size should be, but at a first glance it seems pretty huge.

Simply deleting it won’t do, I use the Kontact suite and by doing this I will surely break something; I’ve tried to see if akonadictl had some cleanup options, but without success.

What is the best way to clean an akonadi installation?

AFAIK there’s no cleaning mechanism for akonadi. You’ve probably already found the fsck and vacuum options for akonadictl. In my case the folder is containing ~5GB of data, the database was recently rebuilt. If it works, don’t fix it.

You may want to search for duplicate flies and then try again cleanup:

karl@erlangen:~> fdupes -r .local/share/.local-mail.directory/
.local/share/.local-mail.directory/inbox/cur/1510808117.R89.erlangen:2,S
.local/share/.local-mail.directory/inbox/cur/1510808117.R177.erlangen:2,S
.local/share/.local-mail.directory/inbox/cur/1510893122.R709.erlangen:2,S
.local/share/.local-mail.directory/inbox/cur/1510893122.R551.erlangen:2,S

.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507696302.R627.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507700669.R259.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507700794.R778.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507701859.R643.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507705556.R373.erlangen:2,S

.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1-1510679269.R782.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1510679269.R782.erlangen:2,S

.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507662537.R416.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507663474.R925.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507696000.R135.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507696302.R109.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507700669.R158.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507700794.R116.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507701859.R735.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507705556.R271.erlangen:2,S

.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1-1510679267.R135.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1510679267.R135.erlangen:2,S

.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507661102.R185.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507662537.R367.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507663474.R229.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507696000.R563.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507696302.R108.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507700669.R403.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507700794.R363.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507701859.R478.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1507705556.R983.erlangen:2,S

.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1510679269.R115.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1-1510679269.R115.erlangen:2,S

.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1505841099.R596.erlangen:2,S
.local/share/.local-mail.directory/.IT.directory/Digikam/cur/1-1505841099.R596.erlangen:2,S

karl@erlangen:~> karl@erlangen:~> akonadictl vacuum
vacuuming database, that'll take some time and require a lot of temporary disk space...
optimizing table SchemaVersionTable...
optimizing table ResourceTable...
optimizing table CollectionTable...
optimizing table MimeTypeTable...
optimizing table PimItemTable...
optimizing table FlagTable...
optimizing table PartTypeTable...
optimizing table PartTable...
optimizing table CollectionAttributeTable...
optimizing table TagTypeTable...
optimizing table TagTable...
optimizing table TagAttributeTable...
optimizing table TagRemoteIdResourceRelationTable...
optimizing table RelationTypeTable...
optimizing table RelationTable...
optimizing table PimItemFlagRelation...
optimizing table PimItemTagRelation...
optimizing table CollectionMimeTypeRelation...
optimizing table CollectionPimItemRelation...
vacuum done
karl@erlangen:~> du -csh .local/share/akonadi
391M    .local/share/akonadi
391M    insgesamt
karl@erlangen:~> karl@erlangen:~> du -csh .local/share/.local-mail.directory/
2,4G    .local/share/.local-mail.directory/
2,4G    insgesamt
karl@erlangen:~> 
karl@erlangen:~> du -csh Mail/
1,1G    Mail/
1,1G    insgesamt
karl@erlangen:~> 

Mail amounts to total of 3.5G, akonadi cache to 391M.

Yes, already tried those options, not much improvement. I’d like to have some more options available for akonadictl and balooctl, but we will have to make it do.

  • files in .local/share/akonadi/file_db_data are cached duplicates or orphaned
  • files in .local/share/akonadi/file_lost+found are duplicates or orphaned
  • log files in .local/share/akonadi/db_data can be huge and are never read in most cases

E.g. /home/karl/.local/share/akonadi/file_db_data/ is 34M while its backup /home-HDD/backup/home/karl/.local/share/akonadi/file_db_data/ is 3.5G.

Thank you, do you have some documentation or some other source to reference this?

https://vizzzion.org/blog/2010/08/demystifying-akonadi/
https://wiki.archlinux.org/index.php/KDE#Akonadi
https://techbase.kde.org/KDE_PIM/Akonadi

Akonadi is a cache unless configured otherwise. You may delete .local/share/akonadi Upon starting akonadi will create again data. Beware: You may want to clear the cache first. This may move cache only items to permanent storage.