Skip to content

Instantly share code, notes, and snippets.

@d-oit
Created October 16, 2025 05:37
Show Gist options
  • Select an option

  • Save d-oit/5bbaa164fe28a9f80cbbc14d0ccafdfa to your computer and use it in GitHub Desktop.

Select an option

Save d-oit/5bbaa164fe28a9f80cbbc14d0ccafdfa to your computer and use it in GitHub Desktop.
Script to resize Dev Drive on Windows 11

πŸͺŸ Resize Dev Drive on Windows 11

This script expands a Dev Drive (.vhdx) and resizes its partition to use the new space.

πŸ“Œ Configuration

  • Path: C:\DevDrive\DEV.vhdx
  • Drive Letter: D:
  • New Size: 160GB (change in script if needed)

πŸš€ Usage

  1. Open PowerShell as Administrator.
  2. Run:
    Set-ExecutionPolicy Bypass -Scope Process -Force
    .\resize-dev-drive.ps1

3. Wait for the process to complete.
4. Your Dev Drive will now reflect the new size in File Explorer.

## ⚠️ Notes

* You can only **increase**, not shrink, the `.vhdx`.
* Ensure no processes are using the Dev Drive before running.
* Adjust `$newSize` in the script if you want a different size.

## 🧰 Commands used

```powershell
Dismount-VHD -Path "C:\DevDrive\DEV.vhdx"
Resize-VHD -Path "C:\DevDrive\DEV.vhdx" -SizeBytes 160GB
Mount-VHD -Path "C:\DevDrive\DEV.vhdx"
Get-Partition -DriveLetter D | Resize-Partition -Size 160GB
```
# ------------------------------------------------------------
# Resize Dev Drive on Windows 11
# Path: C:\DevDrive\DEV.vhdx
# Drive Letter: D
# ------------------------------------------------------------
# Run this script in an elevated PowerShell (Run as Administrator)
# 1. Define variables
$path = "C:\DevDrive\DEV.vhdx"
$newSize = 160GB # πŸ’‘ Change this to your target size
Write-Host "πŸš€ Starting Dev Drive resize process..." -ForegroundColor Cyan
# 2. Dismount the VHD if mounted
Write-Host "πŸ“¦ Dismounting VHD..."
Dismount-VHD -Path $path -ErrorAction SilentlyContinue
# 3. Resize the VHD
Write-Host "πŸ“ Resizing VHD to $newSize..."
Resize-VHD -Path $path -SizeBytes $newSize
# 4. Mount the VHD again
Write-Host "πŸ”„ Mounting VHD..."
Mount-VHD -Path $path
# 5. Extend the partition to use the new space
Write-Host "πŸ“ˆ Extending partition on drive D..."
Get-Partition -DriveLetter D | Resize-Partition -Size $newSize
Write-Host "βœ… Done! Dev Drive resized to $newSize." -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment