Disk Cleanup Before Snapshots on a Windows VPS C: Drive

Disk Cleanup Before Snapshots on a Windows VPS C: Drive

Close-up of a solid-state drive connected inside a computer chassis

TL;DR: Snapshots capture whatever junk sits on C:. Purge WinSxS leftovers you no longer need, temp folders, old IIS logs, and orphaned installer caches before you snapshot—then verify free space and reboot pending flags. Smaller, cleaner images restore faster on any Windows VPS.

Why snapshot size is an operations problem

Providers bill or throttle snapshot storage differently, but the operational pain is universal: fat snapshots take longer to create, longer to copy between regions, and longer to restore when you are already late. A C: drive packed with Windows Update leftovers, user temp files, and multi-gigabyte IIS logs becomes a frozen museum of yesterday’s noise.

Cleanup is not cosmetic. Restoring a bloated image onto a smaller plan can fail outright. Even when restore succeeds, the first boot after rollback may still sit on a nearly full volume—leaving no room for pagefile growth or new updates.

Safe targets versus sacred system state

Delete with a list, not vibes. High-yield, usually safe targets on a typical web or RDP jump guest:

  • %TEMP% and C:\Windows\Temp — clear after closing installers and browsers
  • IIS logs under C:\inetpub\logs\LogFiles — archive off-box if you still need them
  • Windows Update download cache — after confirming updates installed cleanly
  • User Downloads on admin profiles — ISOs and zip kits rarely belong on C: long-term
  • Old memory dumps — once root cause notes are filed

Do not casually purge WinSxS with random blog “disk liberator” scripts. Use supported tools (Dism.exe /Online /Cleanup-Image /StartComponentCleanup and, when appropriate, /ResetBase only with full understanding that you cannot uninstall superseded updates afterward). Prefer documented DISM over third-party cleaners that break servicing stacks.

Pagefile and hibernation myths

Disabling the pagefile to “save snapshot space” can destabilize memory-heavy workloads. Hibernation files matter more on laptops than on most cloud VPS images; if hibernation is already off, there is nothing to reclaim. Measure with Get-PSDrive C and Explorer’s folder properties before changing virtual memory settings.

A pre-snapshot checklist that fits a change window

  1. Drain or pause jobs that write large logs mid-cleanup.
  2. Run Disk Cleanup (cleanmgr) with system files options, or equivalent DISM cleanup.
  3. Rotate and ship IIS/application logs to object storage or a log host.
  4. Empty Recycle Bin for every profile that owns large deletes.
  5. Confirm free space headroom (many teams want ≥15–20% free on C: before imaging).
  6. Note pending reboot; finish reboots before the snapshot if updates require it.
  7. Create the snapshot; label it with date, free-space figure, and change ticket ID.

Skipping the label step produces a gallery of “final-final-v3” images nobody trusts six weeks later.

Application caches that inflate quietly

Build agents, npm/NuGet caches, Docker desktop leftovers (when present), and SQL backup copies dropped on C: dwarf Windows Temp within months. Move package caches to a data volume when the plan allows a second disk. Keep C: for OS and tightly scoped app binaries.

For WordPress or other stacks under IIS, watch wp-content/uploads and backup plugins that default to local zip files. Snapshotting three redundant full-site zips on C: is expensive nostalgia.

Verify cleanup did not break servicing

After aggressive component cleanup, run a quick health pass:

  • Dism /Online /Cleanup-Image /CheckHealth
  • Attempt winget upgrade --dry-run or your patch tool’s inventory if you rely on it
  • Start critical services and hit a local HTTP health URL

If CheckHealth reports issues, prefer repair with /RestoreHealth before you freeze the image. A compact but corrupt snapshot is worse than a slightly larger healthy one.

Provider snapshot quirks worth planning for

Some panels snapshot the whole virtual disk while applications are running; others recommend stopping services for consistency. Databases deserve a proper dump or VSS-aware backup in addition to a crash-consistent disk snapshot. Treat the provider snapshot as rollback insurance for the OS disk, not as your only database recovery plan.

Also note: deleting files after a snapshot does not shrink the already-stored snapshot. Cleanup must happen first if size is the goal.

Measuring before you delete anything

Run a quick size survey of the top-level folders so the cleanup target is a number rather than a guess. The Windows folder, Program Files, users, and any application data directory usually account for almost everything, and knowing which one dominates determines what to spend the change window on.

Free tools that visualise folder sizes save an hour of manual digging, and the result is worth saving to the ticket. A before-and-after figure is the simplest evidence that the cleanup actually did what it claimed.

Without a baseline, a cleanup that reclaimed four gigabytes looks identical to one that reclaimed four hundred megabytes, and the next person has no way to judge whether the effort was worth repeating.

Retention policies instead of periodic panic

The recurring cause of a bloated system drive is logs and application data written at full speed with no rotation. A retention policy that deletes or archives after a fixed period prevents the problem rather than repairing it each quarter.

Write the policy in hours or days, not in vague terms, and configure the application to honour it. Manual deletion at snapshot time is a symptom of a missing setting, and it will recur on the same schedule forever.

Check the policy after every application upgrade as well. Installers frequently reset log paths and retention values to defaults, and a quiet regression can refill the disk within weeks.

Keeping C: lean between snapshot cadences on Windows VPS hosts

Schedule a monthly “pre-image hygiene” task: log shipping, temp purge, and a free-space report mailed to ops. Pair it with your snapshot calendar so every restore point starts from a known-clean baseline. When C: stays predictable, restores onto replacement windows-vps.org plans stop failing for lack of free megabytes—and your snapshot library stops doubling as an archive of forgotten installer ISOs.