Windows Performance

Defrag vs TRIM: HDD and SSD care

Practical Windows guide: defrag vs TRIM: HDD and SSD care without the usual guesswork.

10 min read Beginner Updated 9 Jun 2026

Step-by-step guide

Work through each section in order. Stop when your issue is resolved — you do not need every step for every situation.

What you will achieve

Understand when Windows defragments spinning HDDs versus when it sends TRIM commands to SSDs — and verify the schedule is correct for your drives.

1) How Windows treats each drive type

  1. HDD: Windows runs defragmentation to consolidate fragmented files — beneficial on mechanical drives.
  2. SSD: Windows sends Retrim (TRIM) commands instead of traditional defrag — do not force full defrag on SSDs.
  3. Windows detects drive type via SMART and filesystem — trust automatic scheduling unless you have a unusual RAID setup.

2) Check optimise schedule

  1. Open Settings → System → Storage → Advanced storage settings → Drive optimization (or search "Defragment" in Start).
  2. View Media type column — SSD vs HDD.
  3. Confirm Scheduled optimization is On (default: weekly).

3) Run manually if needed

  1. Select a drive → Optimize. SSDs show "OK" or run Retrim; HDDs show fragmentation percentage before/after.
  2. Do not run third-party defrag tools on SSDs with aggressive rewrite passes.

4) Command-line status

defrag C: /A
Get-PhysicalDisk | Select-Object FriendlyName, MediaType, HealthStatus

/A analyses only — shows whether optimisation is recommended without changing data.

5) SSD lifespan concern

  1. Windows Retrim is low impact — do not run nightly manual defrag on SSDs with third-party tools marketed as "boosters".
  2. Check wear with vendor tool (Samsung Magician, Crucial Storage Executive) if health is in question.

6) RAID and Storage Spaces

  1. Optimise tool may not TRIM all RAID volumes — follow array vendor guidance.

7) Scheduled task name

  1. Task Scheduler → Microsoft → Windows → Defrag — ScheduledDefrag task runs optimisation on idle schedule.

8) HDD fragmentation threshold

  1. Windows optimises HDDs above ~10% fragmentation by default — manual defrag rarely needed on weekly schedule.
  2. External USB HDDs benefit most — include them in Optimise drives list explicitly.

Verification checklist

Note MediaType in Optimise drives — confirm SSD shows OK status weekly. HDD fragmentation percent should drop after Optimise on heavily used spinning disks.

  1. Reboot once after changes that affect services, drivers, or firmware.
  2. Confirm the original problem is resolved under normal daily use, not only immediately after the fix.
  3. Note date, Windows version (Settings → System → About), and what changed in your personal runbook for next time.

Quick reference paths

  • dfrgui.exe
  • taskschd.msc → Defrag
  • Get-PhysicalDisk
  • Admin tools: press Win + X for Terminal (Admin), Device Manager, and Computer Management.

NVMe drives on Windows 10 1709+ receive Retrim automatically; only intervene manually if Optimise reports Needs optimization for weeks unchanged. Check the task history in Task Scheduler if scheduled runs are failing silently.

Related guides

defrag ssd trim vs windows