OneDrive for Business shared library sync loops after restart for large document libraries: Fix Guide
🔍 WiseChecker

OneDrive for Business shared library sync loops after restart for large document libraries: Fix Guide

After restarting your computer, OneDrive for Business may get stuck in a sync loop when syncing a shared library with many files. This problem appears as a repeating cycle of syncing, pausing, and resyncing without ever completing. The root cause is the way OneDrive processes changes in large libraries, especially when the database of file metadata becomes fragmented or too large. This article explains why this loop happens and provides a set of steps to break the cycle and restore normal sync.

Key Takeaways: Breaking the Sync Loop in Large Shared Libraries

  • OneDrive Settings > Sync and backup > Manage backup > Stop backup: Disabling Known Folder Move temporarily can reduce the database load during the fix.
  • OneDrive Settings > Account > Choose folders > Uncheck the problem library: Removing the library from sync and re-adding it rebuilds the sync database from scratch.
  • Run this command in Command Prompt as admin: %localappdata%\Microsoft\OneDrive\onedrive.exe /reset: Resets the OneDrive sync engine without deleting your local files.

ADVERTISEMENT

Why OneDrive Sync Loops After Restart for Large Libraries

When you sync a shared library that contains more than 10,000 files, OneDrive builds a local database to track file metadata and sync status. This database, located at %localappdata%\Microsoft\OneDrive\settings\Business1 for each library, can grow to several gigabytes. After a restart, OneDrive must re-read every file in that library to compare its local database with the server state. If the database is corrupted or fragmented, the sync engine may detect false changes, mark files as needing upload or download, and then re-mark them again in an infinite loop.

The loop is more common when the library contains Office files, which generate frequent co-authoring events and version history. OneDrive attempts to merge changes, but the local database cannot keep up with the number of pending operations. The result is a constant cycle of syncing, pausing, and resyncing. The OneDrive icon in the system tray shows a spinning sync circle indefinitely, and the network activity remains high.

Three factors contribute to this problem: a large library size exceeding 5,000 items, the presence of deeply nested folders, and the use of Known Folder Move which adds the Desktop, Documents, and Pictures folders to the same sync database. The fix involves reducing the load on the sync engine, clearing the corrupted database, and re-adding the library with a fresh sync relationship.

Steps to Fix the Sync Loop for Large Shared Libraries

Follow these steps in order. Do not skip any step. Each step reduces the chance of the loop recurring.

Step 1: Stop Known Folder Move Temporarily

  1. Open OneDrive Settings
    Right-click the OneDrive icon in the system tray near the clock. Select Settings.
  2. Go to Sync and backup
    Click the Sync and backup tab. Then click Manage backup.
  3. Stop backing up all three folders
    Click Stop backup next to Desktop, Documents, and Pictures. Confirm any prompts. This removes those folders from the same sync database that handles the shared library.
  4. Wait for changes to finish
    OneDrive may take a few minutes to move the folders back to their original locations. Wait until the OneDrive icon shows a check mark before continuing.

Step 2: Remove the Problematic Shared Library from Sync

  1. Open OneDrive Settings again
    Right-click the OneDrive icon and select Settings.
  2. Go to Account
    Click the Account tab. Under Shared Libraries, find the library that is looping.
  3. Choose folders
    Click Choose folders. A list of all synced libraries appears.
  4. Uncheck the looping library
    Uncheck the box next to the library name. Click OK. OneDrive will remove the library from syncing. Do not delete any local files manually.

Step 3: Reset the OneDrive Sync Engine

  1. Open Command Prompt as administrator
    Press the Windows key, type cmd, right-click Command Prompt, and select Run as administrator.
  2. Run the reset command
    Type or paste the following command and press Enter: %localappdata%\Microsoft\OneDrive\onedrive.exe /reset
  3. Wait for the reset to complete
    OneDrive will close. A new OneDrive window will appear after about 30 seconds. If it does not appear, run the command again.
  4. Sign in again
    When the OneDrive setup window appears, sign in with your work or school account. Complete the initial setup but do not add any shared libraries yet.

Step 4: Re-add the Shared Library with Selective Sync

  1. Open OneDrive Settings
    Right-click the OneDrive icon and select Settings.
  2. Go to Account
    Click the Account tab. Under Shared Libraries, click Add a shared library.
  3. Select the library
    Find the library that was looping. Select it and click Add.
  4. Choose folders to sync
    After adding, click Choose folders. Uncheck folders that contain more than 5,000 items. Sync only the top-level folders you need. This reduces the database size and prevents future loops.
  5. Click OK and wait
    OneDrive will start syncing only the selected folders. The initial sync may take several hours for a large library, but it should not loop.

ADVERTISEMENT

If OneDrive Still Has Sync Issues After the Main Fix

OneDrive Shows a Red X on Shared Office Files

A red X on a file means the sync engine cannot write the latest version. Open the file from the web browser in SharePoint, save a copy locally, and then move that copy into the synced folder. OneDrive will upload the file and clear the red X.

OneDrive Keeps Pausing Sync Automatically

If sync pauses repeatedly, the library may have more than 300,000 items. SharePoint imposes a 300,000-item limit per library for sync. Use the SharePoint admin center to archive old files or break the library into smaller folders. Then remove and re-add the library as described in Step 2 and Step 4.

OneDrive Uses Too Much CPU After Restart

High CPU usage after restart is normal during the initial sync. However, if it lasts more than 2 hours, pause OneDrive sync by right-clicking the OneDrive icon and selecting Pause syncing for 2 hours. After 2 hours, resume sync. This gives the database time to reorganize.

Files On-Demand vs Always Keep on This Device: Key Differences for Large Libraries

Item Files On-Demand Always Keep on This Device
Description Files appear as online-only placeholders until opened Files are fully downloaded and kept on the local drive
Local storage used Minimal, only metadata and thumbnails Full file size for each file
Sync database size Smaller because only metadata is tracked Larger because the database tracks full file paths and status
Best for libraries with More than 10,000 files Fewer than 5,000 files that you access offline regularly
Risk of sync loop Lower because database is smaller Higher because the database is larger and more prone to fragmentation

For a shared library that previously caused a sync loop, set the entire library to Files On-Demand. Right-click the library folder in File Explorer, select Free up space. This converts all files to online-only placeholders and reduces the database size.

After completing the steps above, your OneDrive sync should no longer loop after restart. Use selective sync to keep the library below 5,000 items per folder. If the loop returns, repeat the reset process and check if the library exceeds SharePoint sync limits. For libraries over 300,000 items, advise the site owner to split the content into multiple libraries using SharePoint migration tools.

ADVERTISEMENT