A retention policy defines how long and under which retention type your data should be stored in a backup repository.
The following retention types are available:
To keep an item until its creation time or last modification time is within the retention coverage.
To keep an item until its latest restore point is within the retention coverage.
Data removal from backup repositories with the Item-Level Retention type occurs every time the creation time or last modification time of an item in a backup file goes beyond the retention coverage.
The following figure demonstrates three simplified backup files, each of which contains Microsoft Office 365 items per year where each item has its own last modification time.
For example, your retention policy is said to be applied at 10:20 AM on September 1, 2018. In such a scenario, Veeam will remove the Item 1 from the Backup 1 repository because the Item 1 exceeds the retention period (2 years in our example) by 20 minutes, as it was last modified exactly at 10:00 AM on September 1, 2016.
The next item to be removed is the Item 2 because its last modifications were made at 10:20 AM on November 11, 2016. That said, when a retention policy is being applied, for example, at 10:30 AM on November 11, 2018, Veeam removes the Item 2 because its age equals 2 years and 10 minutes which exceeds the specified threshold.
The aforementioned algorithm repeats itself until no other items left in a repository, whereupon Veeam completely removes such a repository from the hard drive.
Consider that a backup job does not archive items the last modification time of which exceeds the specified retention period.
Data removal from backup repositories with the Snapshot-Based Retention type occurs every time the latest restore point of an item in a backup file goes beyond the retention coverage.
Mind that each item in a backup file might have its own different version, which is also considered by the retention policy.
A different version means that the user could have changed any attribute in the production environment; for instance, he could have assigned a new category to an email in the mailbox. Such an action leads to a new version of an item to be created during the subsequent backup job session.
For example, the following figure represents two backup files consisting of three items each, where each item has its own backup date. Consider the Item 1 of Backup 1 storage to be an email message, the attributes of which have been modified three times in the production environment; each modification was made on different days (Mon, Tue, and Wed) and each modification was successfully backed up.
That said, there are three different versions of the same item in a backup repository.
According to the figure above, if the retention policy is 1 year and said to be applied at 10:00 AM on September 12, 2018, then all the item versions that exceed the specified retention threshold will be removed from the backup repository. As per example, these versions would be the Version 1 and Version 2. The next version to be removed is the Version 3, the removal of which is about to occur right after 11:03:01 AM September 12, 2018.
Such an approach repeats itself until no other items (or versions of items) left in a repository, whereupon Veeam completely removes such a repository from the hard drive.
Removing Unresolved Data
If a backup job fails to resolve organization mailboxes, SharePoint or OneDrive items, Veeam preserves the latest backup state until the next successful backup of such a mailbox, SharePoint or OneDrive item is created.
The following figure demonstrates an example, wherein there is a backup of the mailbox A which is followed by 6 consecutive unsuccessful attempts (B though G) of backing up that same mailbox during subsequent backup job sessions. In such a scenario, the mailbox A will not be removed until this mailbox is successfully backed up during the attempt H.
Removing Restore Points
Each version of an item may have its own restore points. The restore points of items are removed as soon as they are out of the retention coverage. Once the latest available restore point is removed, the parent item of such a restore point will be removed as well.
Consider the following figure, wherein there are four items (A through D) and two restore points (A1 and A2) both of which belong to the item A. The A1 restore point has already been removed since it was out of the retention scope, whereas the A2 restore point will only be removed after it goes out of the retention coverage (Figure 1).
Once the latest restore point is out of the retention scope and thus can safely be removed, the item A — the parent item of the latest restore point A2 — will be removed as well (Figure 2).
Backup Job Idleness
If a backup job has created a successful backup and then went idle for an indefinite period of time (for example, it might have become disabled), then all the data created by such a job will be removed once it is out of the retention coverage.
The following figure shows an example, wherein the mailbox A has been removed because it was already out of the retention scope (Figure 1) and the next mailbox to be removed is the mailbox B, the removal of which will happen once it goes beyond the retention coverage (Figure 2).
The same is applicable to Microsoft SharePoint and OneDrive for Business.