Windows Server IoT 2022 disk defragementation

Koh Jun Hao 0 Reputation points
2026-10-12T09:03:21.47+00:00

Hi ,

I would like to check with Microsoft following disk defragementation HDD issue:

  1. Defragmentation trigger criteria You previously recommended considering 10–15% fragmentation, less than 20–25% free space, and sustained disk latency. For our custom defragmentation trigger, should defragmentation start when any one of these conditions is met, or only when all conditions are met? Please provide the recommended trigger logic for us to implement.
  2. Built-in ScheduledDefrag not running For our fresh Windows Server 2022 installation, we changed the built-in schedule and left the machine idle, but the scheduled defragmentation still did not run even when fragmentation was around 70%. The latest reply explains how to enable and view Task Scheduler history, but we still need guidance on how to determine why the built-in ScheduledDefrag is not executing as expected. Could you please advise what specific logs/settings/results we should provide for troubleshooting, or whether your technical team can investigate our machine with us?
  3. How to confirm fragmentation is causing performance degradation We understand how to check disk response time using Resource Monitor and PerfMon. However, we still need a clear and measurable method to determine whether fragmentation is actually the cause of the performance degradation, rather than the application, database, CPU, memory, antivirus, storage hardware, or another OS process. Please advise how we should correlate the fragmentation percentage with the PerfMon/latency results and what before/after evidence would be sufficient to conclude that fragmentation was the contributing factor.
  4. Event IDs/log messages For the event logs, could you please specify which Event IDs or messages we should look for that are relevant to defragmentation and help determine whether defragmentation ran successfully or failed? If possible, please provide an example of the expected events/messages.
  5. Fragmentation percentage versus performance For our HDD-based system, is there a recommended fragmentation percentage at which performance degradation would normally become a concern? We understand that there may not be a fixed Microsoft threshold, but we need a practical recommendation that we can use for our operational policy.
    1. Defragmentation trigger criteria You previously recommended considering 10–15% fragmentation, less than 20–25% free space, and sustained disk latency. For our custom defragmentation trigger, should defragmentation start when any one of these conditions is met, or only when all conditions are met? Please provide the recommended trigger logic for us to implement.
     
    1. Built-in ScheduledDefrag not running For our fresh Windows Server 2022 installation, we changed the built-in schedule and left the machine idle, but the scheduled defragmentation still did not run even when fragmentation was around 70%. The latest reply explains how to enable and view Task Scheduler history, but we still need guidance on how to determine why the built-in ScheduledDefrag is not executing as expected. Could you please advise what specific logs/settings/results we should provide for troubleshooting, or whether your technical team can investigate our machine with us?
     
      1. How to confirm fragmentation is causing performance degradation We understand how to check disk response time using Resource Monitor and PerfMon. However, we still need a clear and measurable method to determine whether fragmentation is actually the cause of the performance degradation, rather than the application, database, CPU, memory, antivirus, storage hardware, or another OS process. Please advise how we should correlate the fragmentation percentage with the PerfMon/latency results and what before/after evidence would be sufficient to conclude that fragmentation was the contributing factor.
    
       
    
         1. Event IDs/log messages For the event logs, could you please specify which Event IDs or messages we should look for that are relevant to defragmentation and help determine whether defragmentation ran successfully or failed? If possible, please provide an example of the expected events/messages.
    
          
    
            1. Fragmentation percentage versus performance For our HDD-based system, is there a recommended fragmentation percentage at which performance degradation would normally become a concern? We understand that there may not be a fixed Microsoft threshold, but we need a practical recommendation that we can use for our operational policy.
    

As we need to establish a clear operational approach for the deployed system, it would be helpful if you could address each of the above points directly.

Windows for business | Windows Server | User experience | Other
0 comments No comments

3 answers

Sort by: Most helpful
  1. Ronald Sabiiti 400 Reputation points Independent Advisor
    2026-10-13T05:38:21.17+00:00

    Hello @Koh Jun Hao

    Thank you for clarifying more on this issue and below is the response.

    Practical Defragmentation Thresholds.

    Microsoft does not define a strict fragmentation percentage for triggering defragmentation.

    In practice, many administrators use 20–25% fragmentation as a reasonable threshold.

    For latency‑sensitive workloads (databases, accounting software), you may prefer 15–20%.

    This aligns with general industry practice and balances performance with maintenance overhead.

    Reference: Optimize Drives (Microsoft Learn) (learn.microsoft.com in Bing)

    Power & Idle Conditions for Automatic Maintenance.

    For Automatic Maintenance and ScheduledDefrag to run successfully:

    • Power: Ensure the PC is plugged in (on laptops).

    Idle state: The system must be idle for several minutes; active user input or heavy CPU/disk activity postpones tasks.

    Sleep/hibernate: If the PC sleeps during the scheduled window, the task may be skipped unless “Wake the computer to run this task” is enabled in Task Scheduler.

    Automatic Maintenance: Confirm it is enabled under Control Panel → Security and Maintenance → Automatic Maintenance.

    Reference: Automatic Maintenance in Windows (Microsoft Learn) (learn.microsoft.com in Bing)

    Why It May Not Run on One PC.

    • Drive type: Windows disables defragmentation on SSDs (it runs “Optimize” instead). On HDDs, defrag should run normally.

    Task Scheduler settings: Check Task Scheduler → Microsoft → Windows → Defrag → ScheduledDefrag. If disabled or modified, the task will not run.

    Idle detection: If background processes prevent idle state, the task may not trigger.

    Group Policy/registry: Policies disabling maintenance or defrag can block execution.

    Reference: Task Scheduler Overview (Microsoft Learn) (learn.microsoft.com in Bing)

    Logs & Event IDs to Collect.

    To diagnose why ScheduledDefrag isn’t running:

    • Task Scheduler History Enable history for the ScheduledDefrag task.
      Look for “Task triggered” and “Task completed” entries.
      
      Event Viewer → Applications and Services Logs → Microsoft → Windows → Defrag → Operational
      
         Event ID 258: Defrag started.
      
            Event ID 259: Defrag completed.
      
               Event ID 264: Optimization skipped.
      
               Event Viewer → Microsoft → Windows → TaskScheduler → Operational
      
                  Event ID 100: Task started.
      
                     Event ID 200: Task completed.
      
                        Event ID 201: Task failed.
      

    Reference: Event IDs for Task Scheduler (Microsoft Learn) (learn.microsoft.com in Bing)

    Note**:** Set a 20–25% fragmentation threshold for your operational policy. Ensure Automatic Maintenance is enabled, the PC can reach idle state, and ScheduledDefrag is not disabled. Collect Task Scheduler history and Defrag Operational log (Event IDs 258–264) to identify why the task isn’t executing on the affected PC.

    I hope this helps to better understand the diagnostic options available and the risks involved.

    If this information was helpful, please click Accept Answer.

    Thank you for choosing Microsoft Q&A.

    Was this answer helpful?

    0 comments No comments

  2. Ronald Sabiiti 400 Reputation points Independent Advisor
    2026-10-12T22:24:13.9233333+00:00

    Hello @Koh Jun Hao

    Welcome to Microsoft Q&A!

    Thank you for your patience, and taking the time to elaborate on your concerns.

    1. Defragmentation trigger criteria

    Maintain 20–25% free disk space where practical.

    Analyze first: defrag C: /a /u

    Defragment when analysis shows significant fragmentation, especially on busy HDDs.

    Schedule regular optimization, typically weekly for busy disks.

    Note: Microsoft does not specify one universal fragmentation percentage or latency threshold that triggers defragmentation.

    1. ScheduledDefrag not running
    • Check the schedule in Optimize Drives.
    • Confirm the volume is eligible and uses a supported file system.
    • Check whether the volume is dirty using fsutil dirty query C:.
    • If dirty, run chkdsk before defragmentation.
    • Test manually:
      • Analyze: defrag C: /a /u
      • Optimize: defrag C: /u /v
    • Check power settings, idle conditions, and Task Scheduler status.
      1. Confirm fragmentation affects performance

    Record performance before optimization.

    Analyze fragmentation using defrag C: /a /u.

    Optimize using defrag C: /u /v.

    Repeat the same workload under similar conditions.

    Compare disk response times and application performance.

    Improvement suggests fragmentation contributed to the slowdown, but does not prove it was the only cause.

    4.Event IDs and log messages.

    Review defrag command output for progress and fragmentation statistics.

    Check Optimize Drives → Last run for the latest status.

    Investigate Task Scheduler history for scheduling failures.

    Note: No specific Event IDs are established by the provided guidance.

    1. Fragmentation percentage threshold.

    Microsoft does not define a universal percentage at which fragmentation becomes a performance concern.

    Use analysis results, workload impact, and before-and-after performance measurements.

    Prioritize busy HDDs and maintain adequate free space.

    Practical policy: Schedule regular optimization, analyze HDD fragmentation, and optimize when results and workload performance justify it.

    Microsoft references:

    Defrag command documentation

    I hope this helps to better understand the diagnostic options available and the risks involved.

    If this information was helpful, please click Accept Answer.

    Thank you for choosing Microsoft Q&A.

    Was this answer helpful?


  3. AI answer

    2026-10-12T09:03:59.3366667+00:00
    1. Defragmentation trigger criteria

    A practical trigger should not require all conditions to be true. The supported guidance is:

    • Keep free disk space at 20% to 25% of total disk space to avoid negative disk I/O impact.
    • Run defragmentation regularly, and on busy disks weekly.
    • Fragmentation matters because noncontiguous clusters increase HDD head movement and slow reads and writes.

    For an operational policy on HDDs, the supported approach is:

    • Run analysis first: defrag <volume> /a /u
    • Run defrag when analysis shows meaningful fragmentation, especially on busy HDD volumes.
    • Treat free space below 20% to 25% as an additional trigger, because low free space itself negatively affects disk I/O and also makes defragmentation less effective.

    The context does not provide an official Microsoft rule such as “start when any one condition is met” or “only when all are met,” and it does not provide a supported latency threshold.

    1. Built-in ScheduledDefrag not running

    The supported checks are:

    • In Optimize Drives, review the schedule and change it if needed.
    • The scheduled defragmentation task typically runs every week.
    • The task may not run if:
      • the process would need to wake the computer,
      • the computer is running on battery power,
      • the computer is resumed from being idle.
    • For SSDs, changing the scheduled task frequency does not change the once-per-month cadence for traditional defragmentation.

    For troubleshooting a Windows Server 2022 system where ScheduledDefrag does not run, collect these supported facts first:

    1. Confirm the volume is an eligible local volume.
    2. Confirm the volume is not:
      • locked by the file system,
      • marked dirty,
      • a network drive,
      • a CD-ROM,
      • a file system other than NTFS, ReFS, FAT, or FAT32.
    3. If the volume is dirty, run chkdsk before defragmenting. The dirty state can be checked with fsutil dirty.
    4. Manually test the volume with:
      • defrag <volume> /a /u
      • defrag <volume> /u /v
    5. Check whether the machine was actually idle, powered appropriately, and not blocked by the scheduled-task conditions above.

    The context does not provide a supported escalation path for Microsoft engineering to investigate the machine directly, and it does not list the exact Task Scheduler or Event Viewer log set to submit.

    1. How to confirm fragmentation is causing performance degradation

    The supported evidence is correlation by before/after comparison on HDD workloads:

    • Fragmentation slows HDD access because file data is stored in noncontiguous clusters, increasing read/write head movement.
    • Low free space also negatively affects disk I/O performance.

    A supported way to evaluate contribution is:

    1. Measure the workload symptoms before optimization.
    2. Run fragmentation analysis: defrag <volume> /a /u.
    3. Defragment the HDD volume: defrag <volume> /u /v.
    4. Re-run the same workload under similar conditions.
    5. Compare:
      • fragmentation analysis output before and after,
      • observed disk response behavior before and after,
      • application/file operation time before and after.

    If performance improves after defragmentation under otherwise similar conditions, fragmentation was a contributing factor. The context does not provide a Microsoft-defined formula that proves fragmentation is the sole cause versus CPU, memory, antivirus, database, or storage hardware.

    1. Event IDs or log messages

    The context does not provide specific Event IDs or sample event messages for defragmentation success or failure.

    What is supported is using the command output directly:

    • defrag <volume> /u shows progress.
    • defrag <volume> /v shows verbose fragmentation statistics.
    • defrag <volume> /a performs analysis only.
    • defrag <volume> /t tracks an operation already in progress.

    For operational evidence, the most directly supported output is the verbose defrag result and the Last run status in Optimize Drives. Also note that if analysis is skipped, the Last run time in Optimize Drives might not be updated and can appear up to a month old.

    1. Fragmentation percentage versus performance concern

    The context does not provide an official Microsoft fragmentation percentage threshold such as a fixed “concern starts at X%.”

    The supported practical guidance is:

    • On HDDs, fragmentation degrades performance because noncontiguous clusters increase seek time.
    • Keep free space at 20% to 25%.
    • Run defragmentation regularly, and weekly on busy disks.

    For an operational policy grounded in the available guidance:

    • Treat low free space (<20% to 25%) as a performance concern.
    • Treat busy HDD volumes as candidates for regular weekly optimization.
    • Use defrag /a and defrag /v results to decide whether fragmentation is high enough to justify immediate defragmentation on that workload.

    If a single practical rule is needed for HDD operations, the strongest supported policy from the context is:

    • Maintain 20% to 25% free space and run scheduled optimization weekly; if a busy HDD shows high fragmentation in defrag /a output or measurable improvement after defrag /v, keep that volume on active defragmentation.

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.