VM Hibernation

Microsoft
July 31, 2025

What is VM Hibernation?

VM Hibernation: A Cost-Saving Opportunity
VM hibernation is now (since, May 2024) general available for general purpose VMs! Hibernation is supported on both Linux and Windows operating systems. Virtual Machine (VM) hibernation is a powerful feature that can significantly reduce cloud infrastructure costs while maintaining operational efficiency. In this article we delve into what VM hibernation is, how it works, and the cost-saving opportunities it could bring your organization.

What is VM Hibernation?
VM hibernation is a process that allows a virtual machine to enter a low-power state by saving its current state to disk and then shutting down. Unlike traditional shutdowns, which require a complete restart of the operating system and applications, hibernation preserves the current state, enabling a quick resume of operations when the VM is reactivated. When a VM hibernates, the following occurs:

  1. State Saving: The contents of the VM’s memory (RAM) are written to a hibernation file on disk.
  2. Power Down: The VM is powered off, reducing the resource consumption to zero.
  3. State Restoration: When the VM is powered back on, the saved state is loaded from the disk back into memory, allowing the VM to resume from where it left off.

Benefits of VM Hibernation

1. Cost Savings
One of the primary benefits of VM hibernation is the potential for cost savings. Cloud providers typically charge for VM uptime and resource usage (CPU, memory, storage). By hibernating VMs during periods of inactivity, businesses can significantly reduce these costs.

Reduced Compute Costs: When you hibernate a VM, Azure persists the VM’s in memory state in the OS disk and deallocates the VM. As a result, you don’t have to pay for the VM when its hibernated and you only pay for any storage and networking resources associated with the VM.

2. Operational Efficiency
VM hibernation enhances operational efficiency by allowing quick restoration of services without the need for full system reboots. This is particularly beneficial for scenarios where VM environments are needed occasionally or during specific time windows.

3. Environmental Impact
Reducing active VM instances translates to lower energy consumption, contributing to greener IT practices. By hibernating VMs, organizations can minimize their carbon footprint associated with data center operations.

Practical Examples of VM Hibernation

Development and Testing Environments

Development and testing VMs are often only used a few hours per day. Hibernating these VMs when not in use can give you a substantial cost savings without impacting the productivity of development teams.

Seasonal or Time-bound Applications

Applications with seasonal or time-bound usage patterns, such as payroll processing systems or academic platforms during off-semester periods, can benefit from VM hibernation. These VMs can be hibernated during off-peak times, reducing costs.

Backup and Disaster Recovery

In disaster recovery scenarios, secondary VMs are typically on standby, incurring costs without being actively used. Hibernating these VMs until they are needed can optimize disaster recovery costs.

Implementing VM Hibernation

Steps to Implement VM Hibernation

  1. Prepare the VM for Hibernation:
    1. Windows: Ensure the hibernation feature is enabled in the OS settings.
      1. Open Command Prompt as Administrator.
      1. Run the command: powercfg /hibernate on
    1. Linux: The procedure can vary; ensure swap space is properly configured and the kernel supports hibernation.

Automating VM Hibernation
For automated or scheduled hibernation and resumption, you can use Azure Automation, Logic Apps, or PowerShell scripts. Here’s an example using Azure PowerShell:

  1. Install Azure PowerShell Module (if not already installed):

Powershell: Install-Module -Name Az -AllowClobber -Scope CurrentUser

Powershell: Connect-AzAccount

Powershell:

$resourceGroupName = “yourResourceGroupName”

$vmName = “yourVMName”

# Stop and hibernate the VM

Stop-AzVM -ResourceGroupName $resourceGroupName -Name $vmName -Hibernation

Powershell:

$resourceGroupName = “yourResourceGroupName”

$vmName = “yourVMName”

# Start the VM

Start-AzVM -ResourceGroupName $resourceGroupName -Name $vmName

Use Azure Automation or a scheduled task in Windows/Linux to run these scripts at specific times.

Conclusion
VM hibernation is one of the many ways to optimize your cloud infrastructure costs. By understanding this feature and applying it to your specific use cases, you can achieve significant savings. These kinds of optimization strategies make a difference compared to on-premise infrastructure. Only by using all these different optimization strategies can you fully utilize the cloud’s potential from a financial point of view.

More on the Blog