Delayed Delete

It is not uncommon for a folder or hierarchy of folders in IMAP to contain large amounts of information – after all, IMAP preserves a copy of the messages on the server unless it is specifically deleted.

Three challenges arise when users delete folders especially if an organization is required to comply with archiving regulations;

  1. How to restore the folder if the deletion was accidental?
  2. How to ensure the folder being deleted remains available for inclusion in the next backup cycle?
  3. The deletion of a hierarchy with a lot of messages can create an I/O storm unlinking many individual files and some directories.

Cyrus IMAP introduces delayed deletion of folders, which leaves the deleted folder (or hierarchy thereof) on the filesystem, such that purging the folder hierarchy from the filesystem;

  • becomes a separate event (perhaps triggered during the weekend),
  • can be delayed such that users have a chance to report accidental deletion and administrators can recover without requiring a restore from backup,
  • can be delayed as to ensure that the next backup cycle includes the deleted folder hierarchy.

Configuring Cyrus IMAP for Delayed Delete

To enable or disable Delayed Delete, please check the following settings in imapd.conf(5).

delete_mode: delayed

The manner in which mailboxes are deleted. “immediate” mode is the default behavior in which mailboxes are removed immediately. In “delayed” mode, mailboxes are renamed to a special hiearchy defined by the “deletedprefix” option to be removed later by cyr_expire.

Allowed values: immediate, delayed

deletedprefix: DELETED

If “delete_mode” set to be “delayed”, the prefix for the deleted mailboxes hierarchy. The hierarchy delimiter will be automatically appended.

Back to IMAP Features