{"id":22238285,"url":"https://github.com/nstevens1040/diskpartshrinkvolume","last_synced_at":"2025-10-13T09:30:21.674Z","repository":{"id":70278857,"uuid":"458750969","full_name":"nstevens1040/DiskPartShrinkVolume","owner":"nstevens1040","description":"While attempting to shrink a volume using diskpart in Windows you receive an error stating: The specified shrink size is too big and will cause the volume to be smaller than the minimum volume size. This is what you should do in this scenario.","archived":false,"fork":false,"pushed_at":"2022-02-13T09:42:15.000Z","size":19,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T11:49:46.229Z","etag":null,"topics":["batch","big","cause","desired","diskpart","minimum","partitioning","powershell","shrink","size","smaller","too","volume","windows"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nstevens1040.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-02-13T08:24:02.000Z","updated_at":"2025-04-07T19:48:12.000Z","dependencies_parsed_at":"2023-02-27T03:46:32.367Z","dependency_job_id":null,"html_url":"https://github.com/nstevens1040/DiskPartShrinkVolume","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nstevens1040/DiskPartShrinkVolume","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstevens1040%2FDiskPartShrinkVolume","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstevens1040%2FDiskPartShrinkVolume/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstevens1040%2FDiskPartShrinkVolume/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstevens1040%2FDiskPartShrinkVolume/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nstevens1040","download_url":"https://codeload.github.com/nstevens1040/DiskPartShrinkVolume/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nstevens1040%2FDiskPartShrinkVolume/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014521,"owners_count":26085536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch","big","cause","desired","diskpart","minimum","partitioning","powershell","shrink","size","smaller","too","volume","windows"],"created_at":"2024-12-03T03:16:05.086Z","updated_at":"2025-10-13T09:30:21.662Z","avatar_url":"https://github.com/nstevens1040.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# DiskPartShrinkVolume\nWhile attempting to shrink a volume using diskpart in Windows you receive an error stating: The specified shrink size is too big and will cause the volume to be smaller than the minimum volume size. This is what you should do in this scenario.  \n\n## Make sure ...  \n   - That the partition you are shrinking is (*for lack of better words*) the **last** partition on the disk. Open **diskmgmt.msc** and observe your target disk from left to right. Is there anything to the **right** of your target partition that isn't unallocated space?\n   - You've explicitly told Windows **not** to use pagefile.sys.\n       - This can be accomplished via: \u003cimg height=16px width=auto src=\"https://raw.githubusercontent.com/nstevens1040/images/main/winkey.svg\"/\u003e  → sysdm.cpl → Advanced → Performance \\[Settings\\] → Advanced → Change → No paging file → **Don't forget to click 'Set'!**\n   - You have the correct volume selected? ```SELECT VOLUME 0```\n   - Can the volume reasonably accommodate the shrink operation?  \n      - To be specific, here is an example. Let's say I want to shink my current volume by 20GB (20480MB). If the following PowerShell command evaluates to **True**, then you're **\"not crazy\"**: ```(((Get-Partition -DriveLetter C | % Size) - (Get-PSDrive -Name C | % Used)) / 1MB) -gt 20480```\n   - Building on the example above, the correct **diskpart** command would be: ```SHRINK DESIRED=20480``` (**shrink the currently selected volume by 20GB**)\n   - You observe the shrink operation's progress by launching **%windir%\\system32\\dfrgui.exe**  \n  \n## Still seeing errors?  \nSpecifically, if you are seeing this error,  \n  \n```\nThe specified shrink size is too big and will cause the volume to be smaller than the minimum volume size\n```  \n  \nthen you can view relevant event logs using the **Windows PowerShell** script below (**Run As Admin**).  \n```ps1\n@((Get-WinEvent -FilterXml \"`n\u003cQueryList\u003e`n  \u003cQuery Id=`\"0`\" Path=`\"Application`\"\u003e`n    \u003cSelect Path=`\"Application`\"\u003e*[System[(EventID=259 or EventID=260 or EventID=261)]]\u003c/Select\u003e`n  \u003c/Query\u003e`n\u003c/QueryList\u003e\") | Sort TimeCreated -Descending)\n```  \n  \nIf you're certain that the most recent event that the script returns is relevant, then the script below will tell you the exact file or folder path that is causing problems (**Run As Admin**).  \n```ps1\n@((Get-WinEvent -FilterXml \"`n\u003cQueryList\u003e`n  \u003cQuery Id=`\"0`\" Path=`\"Application`\"\u003e`n    \u003cSelect Path=`\"Application`\"\u003e*[System[(EventID=259 or EventID=260 or EventID=261)]]\u003c/Select\u003e`n  \u003c/Query\u003e`n\u003c/QueryList\u003e\") | Sort TimeCreated -Descending)[0].Properties[2].Value\n```  \n  \nPersonally, I simply deleted the problem files/folders and then proceeded to successfully shrink the volume.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnstevens1040%2Fdiskpartshrinkvolume","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnstevens1040%2Fdiskpartshrinkvolume","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnstevens1040%2Fdiskpartshrinkvolume/lists"}