How to Fix Exchange Server Disk Space Issues and Prevent Database Corruption?
Summary: Lack of disk space can impact the email flow and even result in dismounting of the Exchange Server database. In this post, we will discuss various ways to reduce the disk space and fix the Exchange Server disk space issues. In case the database gets corrupted, you can use the Exchange repair tool mentioned in this post to repair the corrupted database with complete precision.
Exchange Administrators sometimes face problems, such as the users are unable to send or receive emails, the database gets automatically dismounted, and others. Such problems usually occur due to the Exchange Server disk space issues. There are a lot of reasons and causes due to which the server would end up with no disk space. Below are some common causes:
- Accumulation of transaction logs due to backup failure
- Large mailboxes with no quotas
- Insufficient storage planning
- Oversized temporary files and logs
Below, we will discuss several ways to reduce the disk space and fix the Exchange Server disk space issues.
Ways to Fix Exchange Server Disk Space Issues
Here are some ways you can follow to reduce the storage space.
Backup the Database to Purge Transaction Logs
Transaction logs hold temporary data until the database is fully backed up. When the database is backed up, the logs are purged automatically by the Exchange Server system. If you are short of storage, you can first check the storage consumed by the transaction logs folder. If you don’t know the folder path, you can use the command below:
Get-MailboxDatabase | Format-List Name, LogFolderPath
If it is consuming a lot of space, then you can run a full backup of the database. This will purge the transaction logs and reduce the storage.
If this is not an option, you can simulate a backup so that the Exchange Server can purge the transaction logs. For this operation,
- Open Command Prompt as Administrator and type the following command:
Diskshadow
- Then, you need to add the drive where the databases/logs are located. For this, run the below command:
Add volume <drive letter example d:>
- Now, type the below to start the backup:
Begin backup
Create
- Once it is complete, type the following.
End backup
After some time, the transaction logs will be purged automatically.
Clean up Exchange Server Logs
Exchange Server has a number of logs as it create logs for each service and feature. Like other systems, logs need to be archived or removed to ensure that these do not flood the server with unnecessary data. So, you can analyze the Logging folder. The default folder path is:
C:\Program Files\Microsoft\Exchange Server\V15\Logging
For each and every folder, you will find a variety of logs. You can go through them and delete them. However, it is a lengthy process. So, you can create a script to automate the process.
Move the Database to Another Drive
If you have the databases and transaction logs stored in one drive, then you can provision a new drive with ample space and move the databases to this new drive.
First, you need to identify the databases you want to move. For this, use the Get-MailboxDatabase PowerShell command (see the below example).
Get-MailboxDatabase | Format-List Name, EdbFilePath, LogFolderPath
Then, provision the new drive and create a folder to hold the database. After this is done, execute the Move-DatabasePath command as given below.
Move-DatabasePath -Identity "YourDatabaseName" -EdbFilePath "<newpath>\<database name>.edb" -LogFolderPath "<newpath>\Logs"
Confirm the action. This will move the database and logs to the specified path. Depending on the size of the database and the performance of disks, it will take some time. Once done, you can again run the Get-MailboxDatabase command to confirm that the database has been moved.
Move Mail Queue Database to Another Drive
You can also move the mail queue database to another drive to reduce disk storage. The default path of the mail queue database is:
C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue
To move the mail queue database, you need to first stop the Transport Service. For this, run the below command:
Stop-Service MSExchangeTransport
Then, provision the drive and create folder to hold the Queue files. Once this is done, you can run the Move-TransportDatabase command (see the below example).
Move-TransportDatabase -QueueDatabasePath "<new path> \Mail.que" -QueueDatabaseLoggingPath "<new path>\Logs"
Once this is complete, you can start the Transport Service by using the below command:
Start-Service MSExchangeTransport
To verify that the database has been moved successfully, you can use the Get-TransportDatabase command (see the below example).
Get-TransportDatabase | Format-List Name, QueueDatabasePath, QueueDatabaseLoggingPath
Perform Database Defragmentation (if required)
You can also try to remove white space from the database to reduce its size. To check for white space, you can run the following command:
Get-MailboxDatabase -Status | Select-Object Name, DatabaseSize, AvailableNewMailboxSpace | Sort-Object -Descending AvailableNewMailboxSpace
If the database has any white space, you can perform the database defragmentation. For this, you need to first dismount the database. Run the below command:
Dismount -Database <database name>
Once the database is dismounted, run the below command to defragment the database.
Eseutil /d <database name> /t <temporary database name>
After the operation is complete, mount the database by using the below command:
Mount -Database <database name>
Best Practices to Prevent Disk Space Issues
Here are some tips and practices you can follow to prevent disk space issues:
- Store the installation of Exchange Server, databases, and logs in separate drives. This will reduce the risk of getting the disk storage full and also help in better organization of the system, with easier move or increase of resources.
- Monitor the system regularly. This will help identify any problem before it occurs. Having an active monitoring system with ongoing storage surveillance will help detect anomalies and inform the right team when there is a surge or the storage is getting low. This helps in taking action before there is any damage or disruption in the service.
- Perform periodic maintenance of the server. This will keep the server healthy and with enough disk space. These tasks include purging of logs, removing white spaces from the database, and removing unnecessary files or features.
- Take frequent backups. This will reduce the number of transaction logs which are generated by the database. Always have a right backup solution which supports the Exchange Server and is application aware.
What if the Databases or Transaction Logs get Corrupted?
If the disk storage gets full, then the Exchange Server Database (EDB) file or the transaction logs may get corrupted. In such a case, you can recover the database from backup. However, this can lead to data loss as any changes from when the backup is taken to when the issue occurred will be lost. Though you can use the native tools, like ESEUtil, to repair the database, this will take a lot of time and the success rate is not guaranteed.
For hassle-free recovery, you can use Stellar Repair for Exchange – a specialized Exchange recovery tool that can repair corrupted databases (EDB files) and recover mailboxes and all other items, without any data loss. This tool can easily open corrupted databases of any size and from any version of Exchange Server. It presents the entire structure of the databases. You can then browse and granularly export the EDB file items to PST and other file formats.
For quick recovery, you can easily create a new database and then export the mailboxes and other items directly to the new database with automatic mailbox matching. You can also use this tool to migrate EDB file data directly to Microsoft 365.
Conclusion
Above, we have discussed how to possibly fix Exchange Server disk space issues. In case the database gets corrupted due to lack of storage, then the best option is to use Stellar Repair for Exchange to repair the corrupted database file and recover all the items, including user mailboxes, user archives, shared mailboxes, disabled mailboxes, and public folders. It is also imperative to monitor and maintain the Exchange Server to prevent disk space issues in future. For this, you can setup monitoring systems that can send alerts when the storage is less than 20% or any quota which is specified by the company.