Store attachment outside of the database
From Zarafa wiki
Storing attachments outside of the database
From Zarafa version 6 you will have the possibility to store all attachments outside of the MySQL database. The architecture change is made to get a more efficient MySQL caching system and get a smaller database.
Configuring storage method
The attachment storage can be configured in the server.cfg file via the option attachment_storage. When using the install script the default value is set to database, so the attachments are stored in the database. To store the attachment outside of the database, set this option to files and configure the attachment_path. Make sure that there is enough space on this partition.
Migrating database storage to files
Existing installations that already have the attachments in the database have the possibility to migrated to the file storage. In the /usr/share/zarafa directory there is a script available called db-convert-attachments-to-files. This perl script will directly login to MySQL and dump the attachments to the specified directory. You have the run the script with the following options:
perl db-convert-attachments-to-files mysqluser mysqlpassword mysqldatabase path_to_filesystem [delete]
The last delete option is optional. This option will delete the attachments from the database. The script can ran multiple times after each other, without having the attachments duplicated.
The attachments are not all stored in a single directory, but spread over 200 directories. Below the specified attachment_path there are 10 directory (0 - 9). Each directory has 20 subdirectories (0 -19). Via the attachment id in the database, the exact location can be calculated via a fast algorithm.
The attachment is in one of the directory with the id as filename. The stored attachment is the same as the attachment you will see in your email. So via the file command you can see the extension of the attachment.