# 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. In the default delayed mode, mailboxes that are being deleted are renamed to a special mailbox hierarchy under the deletedprefix, to be removed later by cyr_expire(8).

In immediate mode, the mailbox is removed from the filesystem immediately.

Allowed values: immediate, delayed

deletedprefix: DELETED

With delete_mode set to delayed, the deletedprefix setting defines the prefix for the hierarchy of deleted mailboxes.

The hierarchy delimiter will be automatically appended.

Back to Features