Reclaiming dynamically expanding VHDX space


Yes, if space is limited. When you boot a dynamically expanding vhdx there must be enough free space for it to temporarily expand to its maximum size. If there isn't you get a 'not enough space' BSOD at boot.

bsod-not-enough-space-png.25588


If you use a fixed size vhdx there may not be enough space to add another native boot vhdx. By using expanding vhdx I've managed to get a choice two that I can boot from, where there would only be space for one if they were a fixed size.
Hi there

Not sure I understand what you are getting at here. Say you have 150 GB of spare space and you create a fixed size vhdx for windows install say of 52GB (instead of dynamically sizing to the entire space) then if you want more windows installs just create 2nd, 3rd etc vhdx, install with dism /applyimage, and install the boot loader. All you need is a single efi partition on the "main disk" where the bootloader for the windows systems will be installed and then at boot you'll get a choice of what windows system to boot. Simply also in the vhdx file create these as single ntfs partitions before the dism /applyimage.

bcdedit can also be used to check the boot entries in the efi partition.

(note I think the original topic was about "Reducing" the size of the vhdx file / reclaiming space -- not increasing the size which is easy enough by several easy methods).

My disk layout on a test laptop for 2 Windows systems is something like this -- main disk gpt 252GB
efi 100mb, vhdx1 60gb, vhdx2 60 gb the rest linux.
vhdx1 single partition ntfs
vhdx2 single partition ntfs

cheers
jimbo
 

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7
Hi there

Not sure I understand what you are getting at here. Say you have 150 GB of spare space and you create a fixed size vhdx for windows install say of 52GB (instead of dynamically sizing to the entire space) then if you want more windows installs just create 2nd, 3rd etc vhdx, install with dism /applyimage, and install the boot loader. All you need is a single efi partition on the "main disk" where the bootloader for the windows systems will be installed and then at boot you'll get a choice of what windows system to boot. Simply also in the vhdx file create these as single ntfs partitions before the dism /applyimage.

bcdedit can also be used to check the boot entries in the efi partition.

(note I think the original topic was about "Reducing" the size of the vhdx file / reclaiming space -- not increasing the size which is easy enough by several easy methods).

My disk layout on a test laptop for 2 Windows systems is something like this -- main disk gpt 252GB
efi 100mb, vhdx1 60gb, vhdx2 60 gb the rest linux.
vhdx1 single partition ntfs
vhdx2 single partition ntfs

cheers
jimbo

Say I had a 500 GB SSD with
5 vms containing 50 GB in nominal 100 GB vhdx files take up 250 GB space, leaving 250 GB working space.

So I can fire up any of the vms. Total space required equals 5x50 + 100 i.e. 350 GB leaving 200 GB for other use

If I reserved full 500 GB, I would not have enough space, as you need 100GB spare space to fire up any VM so would only have 4 vms plus no spare space for anything else.

In other words I can share the nominal space required between vms rather than each one taking a share I do not need.
 

My Computer

System One

  • OS
    Windows 10 Pro + others in VHDs
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Vivobook 14
    CPU
    I7
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    N/A
    Screen Resolution
    1920x1080
    Hard Drives
    1 TB Optane NVME SSD, 1 TB NVME SSD
    PSU
    Yep, got one
    Case
    Yep, got one
    Cooling
    Stella Artois
    Keyboard
    Built in
    Mouse
    Bluetooth , wired
    Internet Speed
    72 Mb/s :-(
    Browser
    Edge mostly
    Antivirus
    Defender
    Other Info
    TPM 2.0
Say I had a 500 GB SSD with
5 vms containing 50 GB in nominal 100 GB vhdx files take up 250 GB space, leaving 250 GB working space.

So I can fire up any of the vms. Total space required equals 5x50 + 100 i.e. 350 GB leaving 200 GB for other use

If I reserved full 500 GB, I would not have enough space, as you need 100GB spare space to fire up any VM so would only have 4 vms plus no spare space for anything else.

In other words I can share the nominal space required between vms rather than each one taking a share I do not need.
I suppose it depends on how much you want to give to windows -- To upgrade or whatever I believe the minimum space is around 40 GB according to W11 requirements. My Windows files are typically around 55GB with around 15 GB spare space in them and they don't grow so according to your calculation above I'd use 250 GB with 250GB spare. Why would I reserve the full 500GB ??? If I need a new vhdx file I just create a new one in the 250 GB spare space. If you only allocate small vhdx files in the first place then I don't have the problem of needing tyo "reclaim space".

Seems here we are at cross purposes. !!! All I need to fire up a VM is the 50GB allocated to it.

I've always kept the base OS separate from data etc so I've always had small OS systems --saves a lot of aggro too if one has to re-install the OS.

(Same on Linux -- OS on small '/' - root partition and user data in /home etc so if OS needs re-install just install to '/') . Same on Windows - have just a small "C" partition.

Not sure why people have several hundred GB for the windows partition. Also takes longer backing up and restoring.


Cheers
jimbo
 

My Computer

System One

  • OS
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7
I suppose it depends on how much you want to give to windows -- To upgrade or whatever I believe the minimum space is around 40 GB according to W11 requirements. My Windows files are typically around 55GB with around 15 GB spare space in them and they don't grow so according to your calculation above I'd use 250 GB with 250GB spare. Why would I reserve the full 500GB ??? If I need a new vhdx file I just create a new one in the 250 GB spare space. If you only allocate small vhdx files in the first place then I don't have the problem of needing tyo "reclaim space".

Seems here we are at cross purposes. !!! All I need to fire up a VM is the 50GB allocated to it.

I've always kept the base OS separate from data etc so I've always had small OS systems --saves a lot of aggro too if one has to re-install the OS.

(Same on Linux -- OS on small '/' - root partition and user data in /home etc so if OS needs re-install just install to '/') . Same on Windows - have just a small "C" partition.

Not sure why people have several hundred GB for the windows partition. Also takes longer backing up and restoring.

)
Cheers
jimbo
You are not listening. You ask a question, we answer why and then you change the subject.

In simple terms, dynamic storage allows storage to be shared more efficiently - end of story.
 

My Computer

System One

  • OS
    Windows 10 Pro + others in VHDs
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Vivobook 14
    CPU
    I7
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    N/A
    Screen Resolution
    1920x1080
    Hard Drives
    1 TB Optane NVME SSD, 1 TB NVME SSD
    PSU
    Yep, got one
    Case
    Yep, got one
    Cooling
    Stella Artois
    Keyboard
    Built in
    Mouse
    Bluetooth , wired
    Internet Speed
    72 Mb/s :-(
    Browser
    Edge mostly
    Antivirus
    Defender
    Other Info
    TPM 2.0

Latest Support Threads

Back
Top Bottom