Search
Join the Technical Preview Program
See how NVMe-oF removes iSCSI
bottlenecks in your HCI
The Best Hyperconverged
Infrastructure
(HCI) for Enterprise
ROBO, SMB & Edge
The Best Virtual SAN
for Enterprise ROBO, SMB & Edge

Hot Adding / Removing RAM in Hyper-V: Field Notes

  • September 17, 2024
  • 9 min read
StarWind Storage and Virtualization Engineer. Volodymyr specializes in solution architecture and data protection. With a technical background in applied physics, he provides unique analytical leadership in building resilient IT infrastructure. Volodymyr delivers expert guidance on optimizing virtualized environments, disaster recovery, and enterprise-scale storage systems.
StarWind Storage and Virtualization Engineer. Volodymyr specializes in solution architecture and data protection. With a technical background in applied physics, he provides unique analytical leadership in building resilient IT infrastructure. Volodymyr delivers expert guidance on optimizing virtualized environments, disaster recovery, and enterprise-scale storage systems.

Introduction

Changing a VM’s memory without a reboot keeps services online and lets admins react to load spikes faster. Microsoft delivered this option back in Windows Server 2016, and it remains available in Windows Server 2022 and the current Azure Stack HCI release. This write-up shows how the feature behaves on current Windows and Linux releases, points out host-side caveats, and gives an automation example. ​

Test goals

  • Check whether various Windows and Linux guests accept live memory changes.
  • Compare Generation 1 vs Generation 2 VMs.
  • Observe how Hyper-V Manager, PowerShell, and the guest operating systems report the new values.

Lab setup

Component Detail
Host OS Windows Server 2022 Datacenter
VM configuration version 10.0
CPU 2 × Intel Xeon Silver 4208
Starting RAM 4 GB (Dynamic Memory disabled)
Storage Local NVMe SSD
Network 1 GbE

16x VMs total: 8x Generation 1 and 8x Generation 2 ran these guests:

  • AlmaLinux 9.3
  • Debian 12.5
  • Ubuntu Server 22.04.4 LTS
  • openSUSE Leap 15.6
  • Windows 10 22H2
  • Windows 11 23H2
  • Windows Server 2019 LTSC
  • Windows Server 2022 LTSC ​

Test procedure

  1. Raise RAM from 4 GB → 6 GB.
  2. Lower RAM from 6 GB → 2 GB.
  3. Apply each change once in Hyper-V Manager and once with PowerShell:
Set-VMMemory -VMName <VM> -StartupBytes 6GB # or 2GB

Get-VMMemory -VMName <VM>

Windows guests were watched with Task Manager, while Linux guests are monitored with top and dmesg.

IMPORTANT: Dynamic Memory stayed off, since ticking that box deactivates hot-add/hot-remove. ​

Findings

Linux

  • Extra RAM appeared instantly.
  • Shrinking required either a reboot or off-lining blocks through
/sys/devices/system/memory/memoryXX/state.
  • No kernel panic or I/O error occurred.

Windows

What Actually Happens Inside:

  • The Memory Manager resizes the pagefile automatically.
  • Event ID 18012 confirms the new figure in System log.
  • SQL Server and Exchange spot the change within seconds and enlarge internal caches; no service restart needed.

Windows 10, Windows 11, Server 2019, and Server 2022 accepted both operations live. Task Manager refreshed figures almost at once.

Generation & Secure Boot

Gen 1 and Gen 2 behaved alike. For most Linux Gen 2 guests Secure Boot must be disabled, or the firmware template switched to Microsoft UEFI CA. ​

Result matrix

Guest Add RAM Remove RAM Note
AlmaLinux 9.3 Reboot or off-line step needed
Debian 12.5 Reboot or off-line step needed
Ubuntu 22.04 Reboot or off-line step needed
openSUSE 15.6 Reboot or off-line step needed
Windows 10 22H2 Instant change
Windows 11 23H2 Instant change
Server 2019 Instant change
Server 2022 Instant change

✔ = works live ✘ = needs reboot or manual off-line

Position among Memory Modes

 

Mode Reboot for change Can shrink live Typical use
Fixed Yes N/A Low-latency apps
Dynamic No Ballon driver only VDI, dev/test
Hot-Add / Hot-Remove No Windows ✔ Linux ✘ Production guests that spike

Note: Dynamic Memory and Hot-Add/Hot-Remove cannot run together.

Host-side notes

  • NUMA awareness – When you bolt on extra RAM, Hyper-V attempts to keep the new blocks inside the same NUMA node. If the host is already close to capacity, memory can spill into a remote node, adding latency.
  • VMWP working set – The Hyper-V worker process grows to mirror every byte you assign. A busy host with many “elastic” VMs can bump into host commit limits long before Task Manager on the host shows 100 % usage.
  • Live Migration hit – Every MB you add has to move over the wire at migration time. In multi-site clusters that can stretch the failover window, so plan bandwidth with the upper RAM size, not the starting figure.

Comparison with vSphere and KVM

  • vSphere supports hot-add only for RAM; shrinking still needs a reboot or ballooning.
  • KVM/QEMU can hot-remove on any recent kernel, but most enterprise distros leave the feature disabled in default libs.

Automating elasticity with PowerShell

If a VM often creeps above, say, 75 % RAM usage, a tiny loop can bump it by 2 GB on the fly:

$vm = "e.g.Accounting-ERP"

$cap = 75 # %

while ($true) {

$usage = (Get-Counter "\Hyper-V Dynamic Memory Balancer(*)\Physical Memory").CounterSamples |

Where-Object {$_.InstanceName -eq $vm} |

Select-Object -ExpandProperty CookedValue

if ($usage -gt $cap) {

$cur = (Get-VMMemory $vm).Startup

Set-VMMemory $vm -StartupBytes ($cur + 2GB)

}

Start-Sleep 60

}

Use Scheduled Tasks or Windows Admin Center alerts to trigger the loop.

Cluster & Azure Stack HCI

Memory changes are logged like disk growth and replicate across nodes. Azure Stack HCI 23H2 also pushes the data to Azure Monitor, making it easy to spot guests that constantly climb.

Practical checklist

  1. Leave Dynamic Memory off.
  2. Add or remove RAM in blocks aligned with the NUMA node size (often 512 MB).
  3. Keep roughly 1 GB of free host RAM for every 16 GB granted to VMs.
  4. Script the off-line step for each Linux distro in production.
  5. Record every live change in the CMDB.

Closing thoughts

Hot-add and hot-remove keep Windows guests online through both growth and reduction, while modern Linux releases handle live growth and tidy up cleanly after a controlled off-line or reboot. With a few host-side guidelines in place, the feature delivers quick answers to surprise memory demands without risking stability.

Hey! Found Volodymyr’s article helpful? Looking to deploy a new, easy-to-manage, and cost-effective hyperconverged infrastructure?
Alex Bykovskyi
Alex Bykovskyi StarWind Virtual HCI Appliance Product Manager
Well, we can help you with this one! Building a new hyperconverged environment is a breeze with StarWind Virtual HCI Appliance (VHCA). It’s a complete hyperconverged infrastructure solution that combines hypervisor (vSphere, Hyper-V, Proxmox, or our custom version of KVM), software-defined storage (StarWind VSAN), and streamlined management tools. Interested in diving deeper into VHCA’s capabilities and features? Book your StarWind Virtual HCI Appliance demo today!