Does anyone know how to install their PRIMARY Win 11 installation to a VHDX that is EXPANDABLE?


hsehestedt

Well-known member
Guru
VIP
Local time
1:22 PM
Posts
5,166
Location
Texas, USA
OS
Win11 Pro 25H2 (RTM+)
I'm experimenting with installing Windows to VHDs. I can install a secondary copy of Windows 11 to a VHD so that I have a dual boot and I can natively boot that VHD no problem. I even have this working unattended with all drivers getting automatically installed etc.

However, I'm having a bit of a problem doing this for my primary Windows installation. I can install it to a FIXED size VHD no problem, but if I create the VHD as a type "expandable" it doesn't work.

As an example, I create the VHDX as an expandable VHD and tell it that the max allowable size is 500GB. I start Windows setup. It copies all the files to the VHD and performs the first reboot. After reboot, when setup resumes, it will fail every time saying that there is not enough space. If I make the VHD a fixed size, it works fine.

All my research indicates that this should work fine, but it just doesn't. Anyone have any experience with this?

NOTE: There are two ways (at least) to deploy Windows to a VHD. You can use DISM or you can run Windows Setup. Note that I have to use the setup method because I am also running an unattended answer file, so DISM is not an option for me.
 

My Computers My Computers

  • At a glance

    Win11 Pro 25H2 (RTM+)Intel i7-14650HX32 GBNo GPU - Built-in Intel Graphics
    OS
    Win11 Pro 25H2 (RTM+)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Acemagic
    CPU
    Intel i7-14650HX
    Memory
    32 GB
    Graphics Card(s)
    No GPU - Built-in Intel Graphics
    Sound Card
    Integrated
    Monitor(s) Displays
    Varies as machine will often be moved to locations with different monitors
    Screen Resolution
    Varies
    Hard Drives
    1 x 1TB Gen 4 NVMe SSD
    PSU
    120W Power Brick
    Keyboard
    Corsair K70 Max RGB Magnetic Keyboard
    Mouse
    Logitech MX Master 3
    Internet Speed
    1Gb Up / 1 Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
  • At a glance

    Win11 Pro 25H2 (RTM+)Intel i7-1255U16 GBIntel Iris Xe Graphics
    Operating System
    Win11 Pro 25H2 (RTM+)
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo ThinkBook 13x Gen 2
    CPU
    Intel i7-1255U
    Memory
    16 GB
    Graphics card(s)
    Intel Iris Xe Graphics
    Sound Card
    Realtek® ALC3306-CG codec
    Monitor(s) Displays
    13.3-inch IPS Display
    Screen Resolution
    WQXGA (2560 x 1600)
    Hard Drives
    2 TB 4 x 4 NVMe SSD
    PSU
    USB-C / Thunderbolt 4 Power / Charging
    Keyboard
    Backlit, spill resistant keyboard
    Mouse
    Buttonless Glass Precision Touchpad
    Internet Speed
    1Gb Up / 1Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
    Other Info
    WiFi 6e / Bluetooth 5.1 / Facial Recognition / Fingerprint Sensor / ToF (Time of Flight) Human Presence Sensor
What happens if you force the legacy Setup.exe to run?
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
Running legacy setup didn't help.

However, I have a "good enough" workaround for now. For now, I am simply dispensing with putting my primary installation in a VHD. This was mainly experimentation and I'm more comfortable at least running my primary OSD normally rather than in a VHD anyway. But I now have it automated. The primary OS gets installed normally, but by unattended setup. When that is done, I run my program to automatically and unattended install the second OS to a VHD. This is all working flawlessly now.

All I have left to do is a little more scripting to automatically install the second OS upon completion of the first OS. So, the idea is that I boot a thumb drive and walk away. When I come back, both the primary and secondary OSes are fully installed without a single keystroke or mouse click beyond what I need to boot from the flash drive. I'm already 95% of the way there.
 

My Computers My Computers

  • At a glance

    Win11 Pro 25H2 (RTM+)Intel i7-14650HX32 GBNo GPU - Built-in Intel Graphics
    OS
    Win11 Pro 25H2 (RTM+)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Acemagic
    CPU
    Intel i7-14650HX
    Memory
    32 GB
    Graphics Card(s)
    No GPU - Built-in Intel Graphics
    Sound Card
    Integrated
    Monitor(s) Displays
    Varies as machine will often be moved to locations with different monitors
    Screen Resolution
    Varies
    Hard Drives
    1 x 1TB Gen 4 NVMe SSD
    PSU
    120W Power Brick
    Keyboard
    Corsair K70 Max RGB Magnetic Keyboard
    Mouse
    Logitech MX Master 3
    Internet Speed
    1Gb Up / 1 Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
  • At a glance

    Win11 Pro 25H2 (RTM+)Intel i7-1255U16 GBIntel Iris Xe Graphics
    Operating System
    Win11 Pro 25H2 (RTM+)
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo ThinkBook 13x Gen 2
    CPU
    Intel i7-1255U
    Memory
    16 GB
    Graphics card(s)
    Intel Iris Xe Graphics
    Sound Card
    Realtek® ALC3306-CG codec
    Monitor(s) Displays
    13.3-inch IPS Display
    Screen Resolution
    WQXGA (2560 x 1600)
    Hard Drives
    2 TB 4 x 4 NVMe SSD
    PSU
    USB-C / Thunderbolt 4 Power / Charging
    Keyboard
    Backlit, spill resistant keyboard
    Mouse
    Buttonless Glass Precision Touchpad
    Internet Speed
    1Gb Up / 1Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
    Other Info
    WiFi 6e / Bluetooth 5.1 / Facial Recognition / Fingerprint Sensor / ToF (Time of Flight) Human Presence Sensor
I have a 230GB VHDX that takes up 158GB of disk space. I think I created the disk, initialised it and then restored a Macrium image, but I might have just used setup.exe it was months ago and I didn't take notes.
How are you creating the VHDX?

Disk Management allows both VHDs and VHDXs to be fixed or dynamically expanding.

I just did it again, twice, using Macrium and told it to expand partitions to fill the space. I now have a dynamically sized 200GB machine that uses 128GB of space. One VM is VHD and one is VHDX.

1783152552357.webp 1783155131053.webp
 
Last edited:

My Computers My Computers

  • At a glance

    Windows 11 Pro 25H2 26200.8737AMD Ryzen 7 5825U with Radeon Graphics16GB
    OS
    Windows 11 Pro 25H2 26200.8737
    Computer type
    Laptop
    Manufacturer/Model
    Acemagic LX15PRO
    CPU
    AMD Ryzen 7 5825U with Radeon Graphics
    Motherboard
    BIOS CT_BI_AMI_LX15PRO_AB8139_A-004
    Memory
    16GB
    Screen Resolution
    1920 x 1080
    Hard Drives
    SSD 2TB
    Internet Speed
    30 Mbps
    Browser
    Brave
    Antivirus
    Webroot SecureAnywhere Complete beta
  • At a glance

    Windows 11 Pro 23H2 22631.2506Atom N450 1.66GHz2GB
    Operating System
    Windows 11 Pro 23H2 22631.2506
    Computer type
    Laptop
    Manufacturer/Model
    HP Mini 210-1090NR PC (bought in late 2009!)
    CPU
    Atom N450 1.66GHz
    Memory
    2GB
    Browser
    Brave
    Antivirus
    Webroot
  • Acer Swift SF114-34 laptop
    OS Windows 11 Pro 26200.8737
    CPU Pentium Silver N6000
    RAM 4GB
    BIOS v1.17
    SSD Samsung 970 EVO Plus SSD 2TB (an upgrade)
I'm experimenting with installing Windows to VHDs. I can install a secondary copy of Windows 11 to a VHD so that I have a dual boot and I can natively boot that VHD no problem. I even have this working unattended with all drivers getting automatically installed etc.

However, I'm having a bit of a problem doing this for my primary Windows installation. I can install it to a FIXED size VHD no problem, but if I create the VHD as a type "expandable" it doesn't work.

As an example, I create the VHDX as an expandable VHD and tell it that the max allowable size is 500GB. I start Windows setup. It copies all the files to the VHD and performs the first reboot. After reboot, when setup resumes, it will fail every time saying that there is not enough space. If I make the VHD a fixed size, it works fine.

All my research indicates that this should work fine, but it just doesn't. Anyone have any experience with this?

NOTE: There are two ways (at least) to deploy Windows to a VHD. You can use DISM or you can run Windows Setup. Note that I have to use the setup method because I am also running an unattended answer file, so DISM is not an option for me.
Use bog standard diskpart to create the vhdx - when you create the vhdx file there's an option type=fixed to create the full space initially or type=expandable. You set the maximum size with the parameter maximum=.

Then attach the vdisk, select the new disk, exit diskpart and then allocate disk letters and format as per "bog standard HDD's".

Then in normal windows you can run windows setup to install windows to your "virtual disk" just like normal.

I'm not sure though if you need to install Windows via Unattended setup whether it's easily do-able - since on decent hardware you can install W11 very quickly these days is it worth all the extra hassle of doing that. via sysprep etc etc.

To avoid say a clean (from scratch) windows install you can simply clone an existing W11 to the vhdx disk. It helps also if you keep the base W11 small and use different disks for large amounts of user data such as multi-media etc.

VHDX files seem to work better than VHD files. Try it with those instead.

Cheers
jimbo
 

My Computer My Computer

At a glance

Windows XP,11 Linux Fedora Rawhide pre-releas...2 X Intel i7
OS
Windows XP,11 Linux Fedora Rawhide pre-release 45
Computer type
PC/Desktop
CPU
2 X Intel i7
Screen Resolution
4KUHD X 2
How are you creating the VHDX?
I have it entirely automated now. My program asks some questions like what size do you want to make the VHD. Where do you want to locate it? Etc. And then it goes off and does it. It will initially create the VHD and stuff windows into it using DISM. From there, an autounattend.XML answer file takes over. Normally at this point you would reboot and run through the Windows setup screens, but after applying Windows with DISM, when I reboot the answer file takes over and finishes the installation of windows.

Normally if I was installing Windows unattended, I would boot from thumb drive and walk away. When I came back. Like five to 10 minutes later, Windows will have been completely installed. In this case. DISM takes place. Of the initial setup of Windows. So you end up simply removing the Windows PE phase of setup from the answer file. And after the initial setup with DISM. The answer file kicks in..

But for my testing, one of the big hurdles was the fact that I use Bitlocker. I had to figure out that I cannot put the VHD on a Bitlocker volume at all. But I can run Bitlocker within the VHD to encrypt it. I just can't encrypt the hosting volume for that VHD. Thankfully, at least in practical terms, that is a distinction without a difference, because either way I end up with Windows protected by Bitlocker. You just have to be very purposeful in how you implement it.

So, now that I have it all figured out, I just have to carefully document it all
:-)
 

My Computers My Computers

  • At a glance

    Win11 Pro 25H2 (RTM+)Intel i7-14650HX32 GBNo GPU - Built-in Intel Graphics
    OS
    Win11 Pro 25H2 (RTM+)
    Computer type
    PC/Desktop
    Manufacturer/Model
    Acemagic
    CPU
    Intel i7-14650HX
    Memory
    32 GB
    Graphics Card(s)
    No GPU - Built-in Intel Graphics
    Sound Card
    Integrated
    Monitor(s) Displays
    Varies as machine will often be moved to locations with different monitors
    Screen Resolution
    Varies
    Hard Drives
    1 x 1TB Gen 4 NVMe SSD
    PSU
    120W Power Brick
    Keyboard
    Corsair K70 Max RGB Magnetic Keyboard
    Mouse
    Logitech MX Master 3
    Internet Speed
    1Gb Up / 1 Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
  • At a glance

    Win11 Pro 25H2 (RTM+)Intel i7-1255U16 GBIntel Iris Xe Graphics
    Operating System
    Win11 Pro 25H2 (RTM+)
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo ThinkBook 13x Gen 2
    CPU
    Intel i7-1255U
    Memory
    16 GB
    Graphics card(s)
    Intel Iris Xe Graphics
    Sound Card
    Realtek® ALC3306-CG codec
    Monitor(s) Displays
    13.3-inch IPS Display
    Screen Resolution
    WQXGA (2560 x 1600)
    Hard Drives
    2 TB 4 x 4 NVMe SSD
    PSU
    USB-C / Thunderbolt 4 Power / Charging
    Keyboard
    Backlit, spill resistant keyboard
    Mouse
    Buttonless Glass Precision Touchpad
    Internet Speed
    1Gb Up / 1Gb Down
    Browser
    Edge
    Antivirus
    Windows Defender
    Other Info
    WiFi 6e / Bluetooth 5.1 / Facial Recognition / Fingerprint Sensor / ToF (Time of Flight) Human Presence Sensor
Back
Top Bottom