Kopano: hardlink of attachment

A tip: install the package


And add to the crontab

@monthly hardlink /var/lib/kopano/attachments

What are doing that and for what is that helpfull?

remove duplicate attachments:

hardlink -nv /var/lib/kopano/attachments

Directories 211
Objects 239835
IFREG 239624
Comparisons 135
Would link 51
Would save 8384512 <---------------------------

Some additional remarks:
Duplicate attachments will appear with all mailserver implementations. Just assume that you send a large attachment to a collegue: The attachment resides in your “Sent Items” folder an the Inbox of your collegue. If the message is sent to multiple recipients is is stored multiple times…
In earlier Microsoft Exchange versions it was one of the selling points that the storage engine will detect duplicates and just creates pointers to avoid the waste of diskspace. This ability was removed later, as far as I remember because the latency caused by the detection was too high (and storage costs do not matter the same way as in the past).
The idea to use hard links on Unix/Linux based mail server solutions is proven for a long time. Some implementations have done that at the time of storing the message (with the negative effect that moving the message to another folder through imap will most likely store an unlinked copy of the attachment).
I must admit that I never thought about the possibility to try a frequent deduplication with an external tool as described, but it sounds reasonable. Customers with a support contract with Kopano should however check if this is a supported method.
The savings by using the de-duplication we have seen in real world implementations in other solutions have been between 10-20%.

I would recommend to install a downloaded package as it will at least not receive updates. As far as I can see “hardlink” is available from the unmaintained repository.

I’m using hardlink for about two years with great results.