Why This Error Happens
Error 809 occurs when the Windows Storage Optimizer service (defragsvc) detects that a file metadata consolidation job is already registered against a volume, either from a previous session that didn’t terminate cleanly or from an overlapping scheduled task. This typically happens because a stale lock file remains in the %systemroot%\System32\Tasks\Microsoft\Windows\Defrag directory, or because Task Scheduler and a manually triggered “Optimize Drives” operation are competing for the same volume handle. Corrupted NTFS/ReFS metadata cache entries can also prevent the service from releasing its lock after a previous run.
Step-by-Step Resolution Guide
- Stop the conflicting service and task
- Open Services (
services.msc), locate Optimize Drives (defragsvc), right-click and select Stop. - Open Task Scheduler (
taskschd.msc) → navigate toTask Scheduler Library\Microsoft\Windows\Defrag, right-click ScheduledDefrag, and select Disable temporarily.
- Clear the stale metadata lock
- Open Command Prompt as Administrator.
- Run:
fsutil resource stop C:\
(Adjust drive letter as needed. This forcibly clears any hung TxF resource manager locks tied to metadata operations.)
- Restart the Storage Optimizer service
- Back in
services.msc, right-click Optimize Drives → Start. - Alternatively, from an elevated PowerShell prompt:
powershell
Restart-Service defragsvc -Force
- Manually trigger optimization to confirm the lock is cleared
- Open Settings → System → Storage → Advanced storage settings → Optimize Drives.
- Select the affected drive and click Optimize. It should now run without throwing Error 809.
- Re-enable the scheduled task
- Go back to Task Scheduler and re-enable ScheduledDefrag to restore automatic optimization.
Alternative or Verification Steps
- Check Event Viewer (
eventvwr.msc) under Applications and Services Logs → Microsoft → Windows → Defrag → Operational to confirm no further Error 809 entries appear after the optimization completes. - If the error persists, run
chkdsk C: /f /rfrom an elevated Command Prompt to repair underlying volume metadata corruption, then repeat the optimization step.