HashBackup supports the IMAP protocol to enable email servers to be used as backup destinations. This doesn’t make sense for large backups of course, but is handy as a secondary backup of critical system config files, small software repos, etc.
As an example, the HashBackup software repository (Mercurial), including the development environment and complete history since the first version, is backed up to a Gmail account. The repo itself is around 223MB. The last 30 days' history and 12 monthly histories are stored in the backup, yet the backup is only 220MB.
Most IMAP servers have limits to prevent abuse, and HashBackup has several settings so it can work within these limits. Every IMAP server has different limits, so some experimenting might be required for reliable operation as a backup destination.
imap - host and port are required
gmail - host and port are set automatically
IMAP server hostname
IMAP server port. The default is port 143 for non-SSL access. Some IMAP servers may reject non-SSL access because userid and password are sent in the clear. Use port 993 for SSL IMAP. The host and port may be automatically set for some destination types like gmail.
IMAP server userid
IMAP server password for this userid
The folder name to use on the IMAP server. It is created if it doesn’t already exist. Some IMAP servers may allow a name like hashbackup or /hashbackup, while others may require a name like Inbox.hashbackup. Folder names are usually case-sensitive. This seems to be the most non-standard part of an IMAP setup and may require experimenting.
For IMAP, HB limits all file transfers to 100MB by default, but most IMAP servers have even lower limits. HB sends files as email messages, not as attachments, so email message size is the important limit, not attachment size. An encoding overhead of around 10% must also be taken into consideration.
There are 2 ways to control HB’s file sizes:
hb config arc-size-limitto set the maximum archive size. This limit is not always respected exactly, especially with multithreaded backups. Backup’s
-p0option (no multithreading) can be used for better arc file size control. It would not be unusual for HB to create an arc file 5MB larger than
dest.confexactly controls the maximum size of all files sent to a destination. Any file exceeding this limit is split into pieces. See Destination Setup for details.
As an example, if an IMAP server has a 25MB message size limit as Gmail currently does, here are the settings to use:
10% encoding overhead would be 2.5MB, so set
maxsize to 20MB to be safe
arc-size-limit to 15MB to avoid going over
HashBackup implements long retry times for IMAP connect requests,
beginning with 5 seconds and doubling on every error for up to 20
minutes. If this still fails, HB’s normal retry mechanism is used.
retries in Destination Setup for
more details about the normal retry mechanism.
Specifies number of concurrent connections to the IMAP server. Many
IMAP servers have limits on concurrent connections. Each worker uses
maxsize memory for uploads and downloads, so use smaller
maxsize to decrease HB memory usage, and/or set
workers to 1 to conserve memory.
destname myemail type imap host mail.myisp.com port 143 userid email@example.com password mypass dir HashBackup
type gmail, host defaults to imap.gmail.com and port defaults to
993 for SSL. The dir keyword is the Gmail label to use for the backup
files and is created if it doesn’t already exist. As of 2021, Gmail
limits email message size to 25MB, so set
destname myGmail type gmail userid firstname.lastname@example.org password mypass dir HashBackup maxsize 20mb
gmx.com is a free email service with a 50MB message
40mb or less.
destname gmx type imap host imap.gmx.com userid email@example.com password blah dir Backup1 maxsize 45mb