Microsoft Exchange Server is Microsoft’s Email, Calendaring, Contact, Scheduling and Collaboration platform. Originally developed as an email system, Exchange Server has evolved over time and has expanded into a groupware solution with advanced features. It is now a foundational component of Microsoft 365 as a software as a service (SaaS) offering in the Microsoft cloud with Microsoft acting as the service provider.
Microsoft also provides the option of integrating the Exchange Server into our own IT infrastructure.
This involves acquiring the Server License and CALs (Client Access Licenses) to run Microsoft Exchange Server on-premises.
This ensures we will have control and authority over the Exchange platform, including complete control over the Mailbox databases, and the specifications and settings. But this also means we are responsible for managing every aspect of the Exchange environment.
While Microsoft has made it really easy to configure and manage the Exchange environment, the high disk usage of Exchange Servers is a problem that IT administrators have to deal with.
Here we will see how Circular Logging for Mail Databases can be used to free up disk space in the on-premise Exchange Servers.
During the installation, the Exchange the database files are automatically created in a directory path following the below syntax…
\Program Files\Microsoft\Exchange Server\VXX\Mailbox\Mailbox Database NNNNNNNNNN
NOTE:
⇾ VXX (eg: V15 | Directory V15 may change according to Microsoft Exchange Server version)
⇾ Mailbox Database NNNNNNNNNN (eg: Mailbox Database 1136988849)
The Exchange Server Mailbox data can be located in all of the following three locations:-
• Server Memory
⇒ This is where Mailbox data is cached and where new transactions are created.
• Mailbox Database
⇒ Named in the format Mailbox Database NNNNNNNNNN.edb (eg: Mailbox Database
1136988849.edb).
This is an Exchange database file that contains one or more mailboxes and all messaging data,
such as, Emails, Appointments, Meetings, Contacts, Tasks, Notes etc. along with the Mailbox
directory structure.
• Transaction Log Files
⇒ This is where all transactions are stored before they are flushed to the Mailbox database. But it
must be noted that the latest information is always in the server memory, and only once this
information is committed to the Mailbox database, those transactions will be updated in the log
files. Following are the files involved with transaction logs.
⟶ ENN.log (eg: E00.log, E01.log)
This file holds transactions that reflect all actions performed within the Exchange database.
Once this file goes over 1024 KB in size then another file is created, while the existing file is
renamed to another file in the naming format ENNHHHHHHH.log which will be explained
below.
⟶ ENNtmp.log (E00tmp.log, E01tmp.log)
This is a temporary file which is used at the moment when a new log file ENN.log is created.
⟶ ENNHHHHHHH.log (eg: E010002576A.log, E010002576B.log, E010002576C.log)
These files consist of transactions that are already accepted and added to the database. They
are necessary in data recovery scenarios.
⟶ ENNresHHHHH.jrs (eg: E01res0000A.jrs, E01res00001.jrs, E01res00002.jrs)
These files are created along with logs of archive transactions, and they are used by Exchange
when disk space becomes full.
⟶ ENN.chk (eg: E00.chk, E01.chk)
This is a checkpoint file used to maintain a relation between the information included in the
Mail Database and in the Logs. This file determines where recovery will begin. MS Exchange
thinks that all information in transaction log files below the checkpoint file will be safely
stored in the Mailbox database, thus recovery will begin at the location indicated by the
checkpoint file. If the checkpoint file is missing, the recovery will start with the oldest
available transaction log.
Thus, Transactional logs can help us with getting back the MS Exchange Server from data corruption and recover itself to the latest operational state. But at the same time this feature can also heavily tax on disk usage.
Circular Logging applies a storage limit of 1 MB to all our log files. And once that space has been exhausted, Microsoft Exchange Server overwrites the previous log files.
This ensures that the transaction logs are cleared right after the transactions have been moved to the Exchange Database, which prevents further diskspace from being used up by minimizing the number of saved log files.
Interestingly, that is why it is called Circular Logging in the first place. The concept entails repetitive data overwrite rotations where the most recent log file replaces the oldest ones in the database.
The default Circular Logging setting for most Microsoft Exchange Server versions is Disabled.
WARNING: Enabling Circular Logging will have the following effects:-
⇾ Limits our database recovery capabilities. With the log files deleted, it would be impossible to
restore all the data transactions in case the Exchange Server crashes.
⇾ Backing up our database incrementally will not work anymore because that would require a
complete set of log files. Instead, we will be forced to back up the entire database over and over again.
Let us enable Circular Logging in the Microsoft Exchange Server…
• First, we should analyze disk space to see which all Mailbox databases are using up the disk space.
A third-party utility such as TreeSize (https://www.jam-software.com/treesize_free) can be used for this.
• Access MS Exchange Admin Centre via IIS Manager, go to the Sites section.
• In Exchange admin center, go to servers ⇾ databases.
For each database, perform the following actions…
➟ Click Edit icon.
➟ In maintenance, check Enable circular logging, and click Save.
➟ Dismount the selected Database.
➟ Mount the selected Database again.
Wait for some time until the Exchange Server clears up the old Transactional log files. The required time really depends on our disk usage and throughput.
Reanalyzing the disk space using Treesize can give us the actual disk space that has been freed up by Circular Logging. If your Exchange Server has been up and running for more than a year, chances are you have freed up a good amount of usable disk space!