Expanding Windows drives

Granted this isn’t fun. But it’s virtual. We live in an era of exciting expandable disks!

first off start with a full disk. That’s great. In this case the host was proxmox. It doesn’t matter. You apparently have to shut down the VM to expand the disk. Other virtualizers don’t need that. But whatever.

now for the predictable fun. That recovery partition is in the way. Not sure why NTFS needs to be contiguous but here we are.

So now we are stuck. You Google how to expand NTFS drive, how to move recovery partition, how to make disk bigger!! All in vain as everyone is pushing these nifty partition mover programs that don’t run on server. Do you just nuke the partition and hope for the best?

No, we can back it up, delete it, expand our disk and recreate it!

Capture the partition

Dism /Capture-Image /ImageFile:C:\my-system-partition.wim /CaptureDir:S:\ /Name:"My system partition"
Microsoft DiskPart version 10.0.19041.3636

Copyright (C) Microsoft Corporation.
On computer: KOMPUTER

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          250 GB   200 GB

DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             50 MB  1024 KB
  Partition 2    Primary             49 GB    51 MB
  Partition 3    Recovery           522 MB    49 GB

DISKPART> select partition 3

Partition 3 is now the selected partition.

DISKPART> delete partition OVERRIDE

DiskPart successfully deleted the selected partition.

restore the partition

dism /Apply-Image /ImageFile:c:\my-system-partition.wim /Index:1 /ApplyDir:w:\

Then tag the partition back to being a Recovery partition.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             50 MB  1024 KB
  Partition 2    Primary            249 GB    51 MB
  Partition 3    Primary            600 MB   249 GB

DISKPART> select partition 3

Partition 3 is now the selected partition.

DISKPART> set id=27

DiskPart successfully set the partition ID.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary             50 MB  1024 KB
  Partition 2    Primary            249 GB    51 MB
* Partition 3    Recovery           600 MB   249 GB

DISKPART>

depending on the version the command may fail setting type 27, so try:

set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" 

and there we go!

One big happy drive! 🎉

2 thoughts on “Expanding Windows drives

Leave a Reply