How to Defragment the Outlook OST File With OneDrive Tools
🔍 WiseChecker

How to Defragment the Outlook OST File With OneDrive Tools

When your Outlook OST file becomes fragmented, you may notice slower search results, delayed email loading, or increased hard drive activity. This fragmentation happens as Outlook adds and removes items from the offline data file over time. This article explains how to reduce OST file fragmentation using tools provided by OneDrive and built-in Windows utilities, without requiring third-party disk defragmenters.

You will learn the relationship between OneDrive file-on-demand and the OST file, how to trigger a clean rebuild of the OST, and how to verify that fragmentation has been reduced. These steps apply to Outlook 2016, Outlook 2019, Outlook 2021, and Outlook for Microsoft 365 running on Windows 10 or Windows 11.

Key Takeaways: Defragmenting the Outlook OST File with OneDrive

  • OneDrive Settings > Account > Choose folders: Deselect folders to reduce local sync and force OST file size reduction.
  • Control Panel > Mail > Data Files > Remove: Remove and recreate the OST file to eliminate fragmentation entirely.
  • Outlook Account Settings > Change > Offline Settings: Set the slider to a shorter mail sync period to keep the OST file leaner.

ADVERTISEMENT

Why the Outlook OST File Becomes Fragmented and How OneDrive Helps

The Outlook OST file is a local copy of your Exchange or Microsoft 365 mailbox. When you read, delete, or move emails, Outlook modifies this file. Over time, the file grows and shrinks in non-contiguous blocks on the disk, leading to fragmentation. Fragmentation increases the time the disk head needs to locate pieces of the file, slowing down operations like search and folder switching.

OneDrive file-on-demand can indirectly help with OST fragmentation. When OneDrive syncs files on demand, it does not keep full copies of every file locally unless you open them. This reduces the total number of files and disk writes on your system. By controlling which folders OneDrive syncs, you can lower overall disk activity, which reduces the rate at which the OST file fragments. However, OneDrive does not defragment the OST file directly. The actual defragmentation happens when you rebuild the OST file from scratch using Outlook account settings.

The Role of OneDrive Files On-Demand

OneDrive Files On-Demand places placeholder files on your local drive. Full file content downloads only when you open the file. This feature reduces the number of small writes to the disk because the operating system does not constantly update file metadata for synced files. Fewer disk writes mean the OST file is less likely to become fragmented during normal Outlook use. To use this feature, right-click the OneDrive icon in the system tray, select Settings, and under the Sync and backup tab, check the box for Save space and download files as you use them.

How OST Fragmentation Affects Performance

A fragmented OST file causes the disk drive to perform more seek operations. On traditional hard disk drives, this adds up to several seconds of delay when switching folders or searching. On solid-state drives, fragmentation has less impact on read speed but still increases write amplification. Rebuilding the OST file consolidates the data into a single contiguous block, restoring near-instant access to mailbox items.

Steps to Rebuild and Defragment the Outlook OST File

The most effective way to defragment an OST file is to delete it and let Outlook create a fresh copy from the server. The steps below use Outlook account settings and OneDrive folder selection to minimize future fragmentation.

  1. Close Outlook completely
    Make sure Outlook is not running. Press Ctrl+Shift+Escape to open Task Manager. Under the Processes tab, look for any Outlook processes and select End task if present.
  2. Open Mail in Control Panel
    Press Windows key + R, type control, and press Enter. In Control Panel, change the view to Large icons. Click Mail (Microsoft Outlook). The Mail Setup dialog opens.
  3. Locate the current OST file
    In the Mail Setup dialog, click Data Files. The Account Settings window shows a list of data files. Note the path listed under the Location column for your mailbox. This is the OST file you will delete. Click Close.
  4. Remove the OST file from Outlook
    Back in the Mail Setup dialog, click Show Profiles. Select your profile and click Properties. Then click Data Files again. Select the OST file entry and click Remove. Confirm the removal. This does not delete the file from disk yet, but Outlook will no longer use it.
  5. Delete the OST file from disk
    Open File Explorer and navigate to the path you noted in step 3. Right-click the .ost file and select Delete. If you get a file-in-use error, restart your computer and try again before opening Outlook.
  6. Recreate the OST file by starting Outlook
    Open Outlook. It will detect that the OST file is missing and download a new copy from the Exchange or Microsoft 365 server. This process may take several minutes, depending on mailbox size and internet speed. The new OST file is written as a contiguous block on the disk, eliminating fragmentation.
  7. Configure OneDrive to reduce future fragmentation
    Right-click the OneDrive icon in the system tray and select Settings. Go to the Account tab. Under Choose folders, deselect folders that you do not need synced locally. Click OK. This reduces the number of files that OneDrive writes to disk, lowering overall disk activity.
  8. Set a shorter mail sync window in Outlook
    In Outlook, go to File > Account Settings > Account Settings. Select your email account and click Change. Under Offline Settings, drag the slider to a shorter period such as 1 month or 3 months. Click Next and then Finish. A smaller OST file fragments less frequently.

ADVERTISEMENT

If Outlook Still Has Issues After the Main Fix

Outlook Does Not Create a New OST File Automatically

If Outlook opens but shows an error that it cannot find the data file, you may have deleted the wrong file. Verify the OST file path in the Mail Setup dialog again. The file must be deleted from disk, not just removed from the profile. If the problem persists, create a new Outlook profile: go to Control Panel > Mail > Show Profiles > Add. Configure the new profile with your email account. Outlook will create a fresh OST file for the new profile.

OST File Rebuild Takes Too Long

A large mailbox with many folders can take hours to download. Close Outlook and reopen it after 30 minutes. If the download is stuck, check your internet connection. You can also reduce the sync slider to 1 month before starting the rebuild. This limits the initial download to recent items. Older items download later in the background.

OneDrive Files On-Demand Does Not Reduce Fragmentation

If you already have Files On-Demand enabled but still see fragmentation, the issue may be other applications writing to the disk. Use the Windows built-in defragmentation tool for a system-level optimization. Open the Start menu, type defragment, and select Defragment and Optimize Drives. Select your system drive and click Optimize. This defragments all files on the disk, including the OST file, but it is not as effective as rebuilding the OST file for that specific file.

Cached Exchange Mode vs Online Mode: Key Differences

Item Cached Exchange Mode Online Mode
Local OST file Creates and maintains a local OST file No local OST file; data loaded from server on demand
Offline access Full access to cached items without internet No offline access; requires constant connection
Fragmentation risk High; OST file grows and shrinks over time None; no local file exists
Performance on slow networks Better; most operations use local data Worse; each action requires a server round trip
Disk space usage Uses local disk proportional to mailbox size Uses minimal local disk space

Choosing Online Mode eliminates OST fragmentation entirely but requires a stable network connection. Cached Exchange Mode is recommended for most users because it provides offline access and faster local performance. If you rebuild the OST file periodically and keep the sync window short, fragmentation becomes a minor issue.

You can now rebuild your Outlook OST file to eliminate fragmentation and improve performance. After completing the steps above, your Outlook search and folder navigation should feel faster. Consider setting a recurring calendar reminder every three months to rebuild the OST file if your mailbox receives high volumes of email. For advanced users, the Windows Sysinternals tool Contig can defragment individual files on disk, but the rebuild method described here is simpler and more reliable for the OST file.

ADVERTISEMENT