0

I've got Ubuntu 16.04 (Desktop Ed.) For my e-mail I run SMTP server (Postfix/Dovecot/Roundcube). Once in awhile I do a bare metal backup of the whole system with Clonezilla (plus a tarball file backup too just in case). Since it takes rather long time, I often just do a backup of my www directory structure plus databases that I backup from within PHPMyAdmin. Including roundcube.sql file too. "Roundcube" folder proper resides in one of my sites' (I've got a few of them on one physical machine) public_html directories. ALSO... and that's probably a crucial thing here... I have a content of "mail" folder which itself a sub-directory of another folder named after a user in the system (that I use as a login in webmail interface of RC). I think I created it manually when I was installing Roundcube a few months ago. In that "mail" folder I have ".imap" subfolder too with "INBOX", "INBOX.Sent", "Trash" and other folders too. So I think that basically I've got it all as a backup. That's what I thought... So when my HDD died a few days ago, I easily re-created everything from a Clonezilla image made a little over one month ago. BUT... When I go to RC's Inbox now... I only see the e-mails that were there back then (i.e., a month ago, and not the recent ones!) Import of roundcube.sql doesn't help. I still have those recent emails missing... I want to somehow retrieve them or at least to have access to my recent emails (the ones that were in RC's Inbox AFTER the Clonezilla backup had been made).

papakota
  • 81
  • 1
  • 9
  • It's expected that your backup only contains something that was there when the backup was taken. It would be a miracle if it contained something that was modified afterwards, including mails that arrived later. Am I missing something? – Esa Jokinen Jul 31 '20 at 07:48
  • Of course, you are! I don't expect the Clonezilla backup to contain the e-mails that arrived after it was made. I was just telling that since those e-mails weren't in that backup, I was hoping to restore them by restoring RC's db inside PHPMyAdmin, but those newer e-mails are still missing. Basically, I have two types of backups. The rare ones and the frequent ones. The former I make rarely, so that's why it's over a month old. And the latter I do often, so it's fresh. But the "fresh" backup is not an image of the whole system. Just the databases and the content of www directory structure – papakota Jul 31 '20 at 14:20
  • Unfortunately the database is for settings, not for the mail. See my answer for details. – Esa Jokinen Jul 31 '20 at 16:26

1 Answers1

1

The Message Store

Roundcube is not an email server, but an email client a.k.a. mail user agent (MUA); in the Internet Mail Architecture (RFC 5598) it's similar to Outlook and Thunderbird, although it's a webmail written in PHP, runs on a web server and is used via web browser.

The messages are stored in an IMAP server, a Mail Delivery Agent (MDA) including a Message Store (MS). While a MUA could employ a MS (which was typical for POP3), with IMAP the messages are usually stored on the remove server. The messages can be (often partially) cached locally, but caching is less common with webmails. Outgoing messages are sent using an SMTP server (Mail Submission Agent MSA / Message Transfer Agent MTA).

With Roundcube, both IMAP & SMTP servers are configured in config.inc.php:

// The IMAP host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
$config['default_host'] = 'localhost';

// SMTP server host (for sending mails).
$config['smtp_server'] = 'localhost';

The information on the MS accessed using IMAP are in those files you have found in your backups i.e. the folders INBOX, INBOX.Sent, Trash etc. If you haven't got the messages on these files, you don't have backups of them.

Roundcube's database

From the Roundcube Webmail initial database structure in mysql.initial.sql you can deduce that the database contains details that aren't provided by or saved on the IMAP server: session information, users with their settings, contacts, identities with signatures, dictionaries, searches, caches etc.

Roundcube does have an option for message cache (table cache_messages), but it's disabled by default in defaults.inc.php and has some prerequisites for the IMAP server:

// Enables messages cache. Only 'db' cache is supported.
// This requires an IMAP server that supports QRESYNC and CONDSTORE
// extensions (RFC7162). See synchronize() in program/lib/Roundcube/rcube_imap_cache.php
// for further info, or if you experience syncing problems.
$config['messages_cache'] = false;

This is a well-reasoned choice: the default for IMAP server being localhost the messages aren't retrieved from a remote server that could cause latency/unavailability problems. Unless you know you have configured the message cache and how the caching works, it's unlikely you have anything there.

Pro tip of the day: automate your backups.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
  • So simply put, my newer e-mails (those that were after the Clonezilla backup) are gone forever? – papakota Jul 31 '20 at 18:28
  • I'm afraid they are. – Esa Jokinen Jul 31 '20 at 18:53
  • Just to dot the i's and cross the t's... Ironically enough, I made all the backups except for the messages that were kept in RC (well, technically somewhere in Dovecot). My mistake was... I didn't make the backup of ALL www folder. Just its subfolders where my sites' files were. There was a folder "HTML" under www in which Dovecot kept my messages in "Mail" folder... – papakota Aug 01 '20 at 13:10