Disable Automatic Defragmentation Using Regedit
This guide explains how to disable the Windows automatic background file defragmentation and drive optimization schedule using the Windows Registry Editor (Regedit). By modifying specific registry keys, you can completely prevent Windows from running background defragmentation tasks during system idle periods or scheduled automatic maintenance windows.
Step 1: Open the Registry Editor
- Press
Windows Key + Rto open the Run dialog box. - Type
regeditand press Enter or click OK. - Click Yes if prompted by User Account Control (UAC).
Step 2: Disable the Drive Optimization Service via Registry
Disabling the underlying defragmentation service prevents the background optimization tasks from triggering automatically.
In the Registry Editor address bar, navigate to the following path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\defragsvcIn the right pane, locate the Start DWORD value.
Double-click Start to modify it.
Change the Value data from
3(Manual) to4(Disabled).Click OK.
Step 3: Disable Background Boot Optimization and File Prefetch Defrag
Windows also contains a legacy background optimization feature that rearranges boot files during system idle times. To turn this off:
Navigate to the following path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction(If the
DfrgorBootOptimizeFunctionkeys do not exist, right-click the parent key, select New > Key, and name them accordingly).In the right pane, double-click the Enable string value (
REG_SZ).Change its Value data from
YtoN.Click OK.
Step 4: Restart Your Computer
Close the Registry Editor and restart your computer to apply the changes. The automatic background defragmentation schedule and related drive optimization services will now remain disabled.