{"id":645,"date":"2026-08-17T22:59:16","date_gmt":"2026-08-17T22:59:16","guid":{"rendered":"https:\/\/windows-vps.org\/blog\/?p=645"},"modified":"2026-10-17T22:10:27","modified_gmt":"2026-10-17T22:10:27","slug":"windows-server-disk-cleanup-winsxs-pagefile","status":"publish","type":"post","link":"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/","title":{"rendered":"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files"},"content":{"rendered":"<p class=\"wp-block-paragraph\">A Windows Server that runs out of disk does not fail gracefully. Services stop, the event log stops writing, Windows Update fails with error 0x80070070, and backup jobs die quietly half-way through a VSS snapshot. On a VPS the root volume is usually 60\u2013120 GB, so the usual Windows growth patterns \u2014 WinSxS from cumulative updates, pagefile sizing for 16 GB of RAM, and IIS or .NET logs nobody rotates \u2014 matter far more than they do on a physical server with spare bays. This is the cleanup order that reclaims space without breaking servicing, and the settings that stop it refilling.<\/p>\n\n<h2 class=\"wp-block-heading\">Measure before deleting anything<\/h2><p class=\"wp-block-paragraph\">Start with the free-space baseline, and record the top-level directories by size rather than opening Explorer and guessing. <code>Get-ChildItem -Recurse<\/code> on <code>C:\\Windows<\/code> can take several minutes on a busy server; it is still cheaper than restoring a broken component store.<\/p><p class=\"wp-block-paragraph\">Before you start deleting, size the volume against realistic growth \u2014 the plan tiers on the <a href=\"https:\/\/windows-vps.org\/index.html#plans\">Windows VPS plan comparison<\/a> list the disk allocation you actually get, which is the number that decides whether 60 GB is enough.<\/p><pre class=\"wp-block-code\"><code>Get-Volume | Where-Object DriveLetter -eq 'C' |\n  Select-Object DriveLetter, FileSystemLabel, @{n='FreeGB';e={[math]::Round($_.SizeRemaining\/1GB,1)}}, @{n='SizeGB';e={[math]::Round($_.Size\/1GB,1)}}\n\nGet-ChildItem C:\\ -Directory -Force -ErrorAction SilentlyContinue |\n  ForEach-Object {\n    [pscustomobject]@{\n      Path = $_.FullName\n      GB   = [math]::Round((Get-ChildItem $_.FullName -Recurse -Force -File -ErrorAction SilentlyContinue |\n              Measure-Object Length -Sum).Sum \/ 1GB, 2)\n    }\n  } | Sort-Object GB -Descending | Select-Object -First 12<\/code><\/pre><h2 class=\"wp-block-heading\">WinSxS: use DISM, never Explorer<\/h2><p class=\"wp-block-paragraph\">The only supported tool is <code>DISM \/Online \/Cleanup-Image<\/code>, and the order matters: analyze, clean, then optionally reset the base. Analysis reports how much is reclaimable before you commit to a change that removes the ability to uninstall recent updates; each pass takes 10\u201340 minutes on a shared CPU, so run it from a console session that survives a dropped RDP connection.<\/p><p class=\"wp-block-paragraph\"><code>\/ResetBase<\/code> removes the superseded versions that allow uninstalling the most recent update. On a VPS that is usually the right trade-off \u2014 you want the space more than you want to roll back a cumulative update \u2014 but run it after a patch cycle has been validated, not in the middle of one. The PowerShell equivalent, <code>Optimize-WindowsImage<\/code> on a mounted WIM, does not apply to an online installation; do not mix the two up.<\/p><figure class=\"wp-block-table\"><table><thead><tr><th>Cleanup target<\/th><th>Typical reclaim on a 100 GB VPS<\/th><th>Safe to run online<\/th><th>Notes<\/th><\/tr><\/thead><tbody><tr><td>DISM StartComponentCleanup<\/td><td>1.5\u20134 GB<\/td><td>Yes<\/td><td>Removes superseded components older than 30 days<\/td><\/tr><tr><td>DISM StartComponentCleanup \/ResetBase<\/td><td>adds 0.5\u20132 GB<\/td><td>Yes<\/td><td>Blocks uninstall of the last installed update<\/td><\/tr><tr><td>Windows Update Cleanup (cleanmgr)<\/td><td>2\u20136 GB<\/td><td>Yes<\/td><td>Overlaps with DISM; run one, then the other<\/td><\/tr><tr><td>Delivery Optimization cache<\/td><td>1\u20133 GB<\/td><td>Yes<\/td><td>Clear-DeliveryOptimizationCache<\/td><\/tr><tr><td>CBS, DISM and MSI logs<\/td><td>200\u2013800 MB<\/td><td>Yes<\/td><td>Logs grow without bound; rotate or delete<\/td><\/tr><tr><td>IIS logs (daily W3C)<\/td><td>0.5\u20135 GB<\/td><td>Yes<\/td><td>Depends entirely on traffic<\/td><\/tr><tr><td>Hibernation file<\/td><td>40% of RAM<\/td><td>Yes on VPS<\/td><td>Disable unless you need hybrid sleep<\/td><\/tr><tr><td>Pagefile<\/td><td>fixed or system managed<\/td><td>Reboot needed<\/td><td>Never disable on a low-RAM VPS<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Expected reclaim on a 100 GB Windows Server VPS (Server 2022\/2025, 8 GB RAM)<\/figcaption><\/figure><h2 class=\"wp-block-heading\">Windows Update cleanup and Delivery Optimization<\/h2><p class=\"wp-block-paragraph\">Superseded update packages are the second-largest consumer after WinSxS. Disk Cleanup still works headlessly and is scriptable, which is why it survives on servers without the GUI role. Be careful with <code>\/sagerun<\/code> on a production host, though: it also empties the Recycle Bin and clears temp directories for every profile it can reach, including an application pool identity. If an in-flight deployment stages files under <code>C:\\Windows\\Temp<\/code>, schedule the task outside deployment windows.<\/p><p class=\"wp-block-paragraph\">On a small VPS it is also worth capping the update cache rather than deleting it repeatedly. <code>HKLM\\SOFTWARE\\Policies\\Microsoft\\Windows\\DeliveryOptimization<\/code> accepts <code>MaxCacheSize<\/code> as a percentage of disk; 5% of a 100 GB volume leaves about 5 GB of peer cache, enough for a single host to stop re-downloading the same cumulative update every month.<\/p><pre class=\"wp-block-code\"><code># Configure once interactively, then run unattended\ncleanmgr \/sageset:1        # tick Windows Update Cleanup, DoS files, logs, temp\ncleanmgr \/sagerun:1\n\n# Delivery Optimization cache and its own cleanup\nGet-DeliveryOptimizationStatus | Select-Object FileId, FileSizeInBytes\nClear-DeliveryOptimizationCache -Force<\/code><\/pre><h2 class=\"wp-block-heading\">Pagefile and hibernation on a constrained VPS<\/h2><p class=\"wp-block-paragraph\">The pagefile is not junk. Windows uses it for crash dumps, for commit charge beyond physical RAM, and for trimming working sets under memory pressure. On a VPS with 8 GB of RAM and a .NET workload, disabling it entirely is a reliable way to produce <code>OutOfMemoryException<\/code> under load even when Task Manager shows free memory.<\/p><p class=\"wp-block-paragraph\">What you can do is set a fixed size instead of letting it grow, so the file does not fragment and the disk reservation is predictable. A common rule for a VPS is 1.5\u00d7 RAM up to 8 GB, then 1\u00d7 beyond that, with a hard cap at 16 GB.<\/p><pre class=\"wp-block-code\"><code>$cs = Get-WmiObject Win32_ComputerSystem\nif ($cs.AutomaticManagedPagefile) { $cs.AutomaticManagedPagefile = $false; $cs.Put() }\n\n$pf = Get-WmiObject Win32_PageFileSetting -Filter \"Name='C:\\\\pagefile.sys'\"\nif (-not $pf) { $pf = (Get-WmiObject Win32_PageFileSetting).CreateInstance() }\n$pf.Name = \"C:\\\\pagefile.sys\"\n$pf.InitialSize = 8192\n$pf.MaximumSize = 8192\n$pf.Put()\n\n# Hibernation: powercfg \/h off frees hiberfil.sys\npowercfg.exe \/hibernate off<\/code><\/pre><h2 class=\"wp-block-heading\">Log files that grow without a cap<\/h2><p class=\"wp-block-paragraph\">Logs are the quietest consumer and the easiest win. A single IIS site writing 50 MB of W3C logs a day consumes 18 GB a year; SQL Server error logs, CBS logs, and .NET PerfMon logs all behave the same way. Set retention in the product where possible rather than relying on a script to delete files later.<\/p><p class=\"wp-block-paragraph\">The W3C format adds one file per site per day by default, and nothing in IIS enforces a total-size limit for the folder as a whole \u2014 <code>truncateSize<\/code> caps each individual log file, not the directory. On a server hosting a dozen small sites that distinction alone can mean 15 GB of logs where you expected 1 GB, so combine the configuration below with a folder-level retention job.<\/p><pre class=\"wp-block-code\"><code># IIS: cap total log volume per site, in bytes\nSet-WebConfigurationProperty -PSPath 'IIS:\\' `\n  -Filter \"system.applicationHost\/sites\/siteDefaults\/logFile\" `\n  -Name truncateSize -Value 1073741824\nSet-WebConfigurationProperty -PSPath 'IIS:\\' `\n  -Filter \"system.applicationHost\/sites\/siteDefaults\/logFile\" `\n  -Name periodicRestart.time -Value \"00:00:00\"\n\n# Older than 30 days, from a scheduled job\nGet-ChildItem C:\\inetpub\\logs\\LogFiles -Recurse -Filter *.log |\n  Where-Object LastWriteTime -lt (Get-Date).AddDays(-30) | Remove-Item -Force<\/code><\/pre>\n<p class=\"wp-block-paragraph\">If cleanup keeps coming back every month, the volume is undersized rather than badly managed \u2014 compare the disk allocations on the <a href=\"https:\/\/windows-vps.org\/\">main Windows VPS hosting page<\/a> before buying extra storage you will not fill.<\/p>","protected":false},"excerpt":{"rendered":"<p>A Windows Server that runs out of disk does not fail gracefully. Services stop, the event log stops writing, Windows Update fails with error 0x80070070, and backup jobs die quietly half-way through a VSS snapshot. On a VPS the root volume is usually 60\u2013120 GB, so the usual Windows growth patterns \u2014 WinSxS from cumulative &#8230; <a title=\"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files\" class=\"read-more\" href=\"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/\" aria-label=\"Read more about Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":11,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-645","post","type-post","status-publish","format-standard","hentry","category-tutorials-guides"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files - Windows VPS Blog<\/title>\n<meta name=\"description\" content=\"A Windows Server that runs out of disk does not fail gracefully. Services stop, the event log stops writing, Windows Update fails with error 0x80070070,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files\" \/>\n<meta property=\"og:description\" content=\"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files\" \/>\n<meta property=\"og:url\" content=\"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/\" \/>\n<meta property=\"og:site_name\" content=\"Windows VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-17T22:59:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-17T22:10:27+00:00\" \/>\n<meta name=\"author\" content=\"windows-vps\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@myxiechengxuan\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"windows-vps\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/\",\"url\":\"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/\",\"name\":\"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files - Windows VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/#website\"},\"datePublished\":\"2026-08-17T22:59:16+00:00\",\"dateModified\":\"2026-10-17T22:10:27+00:00\",\"author\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58\"},\"description\":\"A Windows Server that runs out of disk does not fail gracefully. Services stop, the event log stops writing, Windows Update fails with error 0x80070070,\",\"breadcrumb\":{\"@id\":\"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/windows-vps.org\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#website\",\"url\":\"https:\/\/windows-vps.org\/blog\/\",\"name\":\"Windows VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/windows-vps.org\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58\",\"name\":\"windows-vps\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g\",\"caption\":\"windows-vps\"},\"sameAs\":[\"https:\/\/windows-vps.org\/blog\",\"https:\/\/x.com\/myxiechengxuan\"],\"url\":\"https:\/\/windows-vps.org\/blog\/author\/myxiechengxuan\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files - Windows VPS Blog","description":"A Windows Server that runs out of disk does not fail gracefully. Services stop, the event log stops writing, Windows Update fails with error 0x80070070,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/","og_locale":"en_US","og_type":"article","og_title":"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files","og_description":"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files","og_url":"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/","og_site_name":"Windows VPS Blog","article_published_time":"2026-08-17T22:59:16+00:00","article_modified_time":"2026-10-17T22:10:27+00:00","author":"windows-vps","twitter_card":"summary_large_image","twitter_creator":"@myxiechengxuan","twitter_misc":{"Written by":"windows-vps","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/","url":"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/","name":"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files - Windows VPS Blog","isPartOf":{"@id":"https:\/\/windows-vps.org\/blog\/#website"},"datePublished":"2026-08-17T22:59:16+00:00","dateModified":"2026-10-17T22:10:27+00:00","author":{"@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58"},"description":"A Windows Server that runs out of disk does not fail gracefully. Services stop, the event log stops writing, Windows Update fails with error 0x80070070,","breadcrumb":{"@id":"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/windows-vps.org\/blog\/windows-server-disk-cleanup-winsxs-pagefile\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/windows-vps.org\/blog\/"},{"@type":"ListItem","position":2,"name":"Windows Server Disk Space Management: Best Practices for WinSxS, Logs, and Temporary Files"}]},{"@type":"WebSite","@id":"https:\/\/windows-vps.org\/blog\/#website","url":"https:\/\/windows-vps.org\/blog\/","name":"Windows VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/windows-vps.org\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/44caceed916d0db318aa08d5623a7a58","name":"windows-vps","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/windows-vps.org\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3f2573db5afcd1a6ab9abcc5d48fc8e42584bc87ab9d98cc156e5b2097766dd9?s=96&d=mm&r=g","caption":"windows-vps"},"sameAs":["https:\/\/windows-vps.org\/blog","https:\/\/x.com\/myxiechengxuan"],"url":"https:\/\/windows-vps.org\/blog\/author\/myxiechengxuan\/"}]}},"_links":{"self":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/comments?post=645"}],"version-history":[{"count":5,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/645\/revisions"}],"predecessor-version":[{"id":890,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/posts\/645\/revisions\/890"}],"wp:attachment":[{"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/media?parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/categories?post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/windows-vps.org\/blog\/wp-json\/wp\/v2\/tags?post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}