What are the charges for using this feature?
Once a VM is placed in a hibernated state, you are not charged for the VM, just like how you are not charged for VMs in a stop (deallocated) state. You are only charged for the OS disk, data disks and any static IPs associated with the VM.
Can I enable hibernation on existing VMs?
No, you cannot enable hibernation on existing VMs. You can only enable hibernation at the time of creating a VM.
Can I resize a VM with hibernation enabled?
No. Once you enable hibernation on a VM, you cannot resize the VM.
Can I modify a VM once it is in a hibernated state?
No, once a VM is in a hibernated state, you cannot perform actions like resizing the VM and modifying the disks. Additionally, you cannot detach any disks or networking resources that are currently attached to the VM or attach new resources to the VM. You can however stop(deallocate) or delete the VM if you want to detach these resources.
What is the difference between stop(deallocating) and hibernating a VM?
When you stop(deallocate) a VM, the VM shuts down without persisting the memory contents. You can resize stop(deallocated) VMs as well as detach/attach disks and networking resources to the VM.
When you hibernate a VM, the memory contents are first persisted in the OS disk and then the VM hibernates. You cannot resize VMs in a hibernated state, nor detach/attach disks and networking resources to the VM.
Can you disable hibernation?
No, you cannot disable hibernation on a VM.
Can I initiate hibernation from within the VM?
To hibernate a VM you should use the Azure Portal, CLI, API and Powershell commands. Triggering hibernation from inside the VM will still result in your VM being billed for the compute resources.How do I get started with hibernate/resume?
To get started, enable hibernation at the time of creating the VM through REST APIs, ARM templates and SDKs. For example, to create a VM with hibernation enabled use the following API command:
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM?api-version=2021-03-01
{ "location": "westcentralus",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_D2s_v4"
},
"storageProfile": {
"imageReference": {
"sku": "2019-Datacenter",
"publisher": "MicrosoftWindowsServer",
"version": "latest",
"offer": "WindowsServer"
},
"osDisk": {
"caching": "ReadWrite",
"managedDisk": {
"storageAccountType": "Standard_LRS"
},
"name": "myVMosdisk",
"createOption": "FromImage"
}
},
"additionalCapabilities": {
"hibernationEnabled": true
}
}
For Linux VMs, you need to additionally configure the guest OS to enable hibernation using steps listed in appendix A.
Once the VM is created, you can hibernate the VM using the following API command:
POST
https://management.azure.com/subscriptions/.../providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate?hibernate=true&api-version=2021-03-01
After the VM is hibernated, you can check the VM Instance View to get the hibernated state as shown below:
"statuses":
[
{
"code": "ProvisioningState/succeeded",
"level": "Info",
"displayStatus": "Provisioning succeeded",
"time": "2019-10-14T21:30:12.8051917+00:00"
},
{
"code": "PowerState/deallocated",
"level": "Info",
"displayStatus": "VM deallocated"
},
{
"code": "HibernationState/Hibernated",
"level": "Info",
"displayStatus": "VM hibernated"
}
]
To resume the VM, simply Start the VM using the Azure Portal, API, CLI, PowerShell or SDKs
POST https://management.azure.com/subscriptions/../providers/Microsoft.Compute/virtualMachines/{vmName}/start?api-version=2021-03-01
Are there any prerequisites for hibernate/resume?
Yes, the prerequisites to use hibernate/ resume are:
Hibernation should be supported by the VM size.
Hibernation should be supported by the OS.
You should use a persistent OS disk which is large enough to store the contents of the RAM, OS and other applications running on the VM.
The VM must have the Azure VM Agent installed
Which regions support hibernate/resume during private preview?\
During private preview, you can use hibernate/resume in the following regions. We will continue expanding this feature to more regions in 2021 and 2022.

Which SKUs are supported?
This feature is supported on premium general purpose SKUs. We recommend using hibernate/resume on the following SKUs:
Dsv3
Dsv4
Dasv4
F1s
Fsv2
Esv4
For Windows, VM sizes with up to 32GB RAM will be supported. This limit might increase or decrease based on performance testing of hibernate/resume.
Support for non-premium SKUs like Dv3,Dv4, etc and Specialized SKUs will be made available in 2022.
Which OS versions are supported?
The following OS versions are supported:
Windows 10 19H1 and higher
Windows Server 2019 and higher
Ubuntu 18.04
Ubuntu 20.04
Do I need to enable hibernation in the guest OS?
For Windows VMs, when you enable hibernation on the VM, Azure automatically configures the guest OS to enable hibernation inside the VM.
For Linux VMs, you can install the hibernation-setup-tool (available here) on your VM. This will configure the guest OS to support hibernation. For more details, refer to appendix A.
How can I enable hibernate/resume for existing VMs?
To enable hibernate/resume on existing Linux VMs (with and without temp storage) or Windows VMs without temp storage such as Dsv4, follow these steps:
For Windows VMs:
Stop-deallocate the VM.
Enable hibernation on the VM (refer to REST APIs in FAQ1).
Start the VM.
For Linux VMs:
Stop-deallocate the VM.
Enable hibernation on the VM (refer to REST APIs in FAQ1).
Start the VM.
Configure hibernation in the guest OS (refer to appendix A).
To enable hibernate/resume on existing Windows VMs with temp storage such as Dsv3 or F1s, follow these steps:
If the page file is not located on the OS disk then first move the page file to the OS disk. Refer to Appendix B for more details on how to move the page file to the OS disk.
Stop-deallocate the VM.
Enable hibernation on the VM (refer to REST APIs in FAQ1).
Start the VM.
What are the charges for using this feature?
Once a VM is placed in a hibernated state, you are not charged for the VM, just like how you are not charged for VMs in a stopped-deallocated state. You are only charged for the OS disk, data disks and any networking resources associated with the VM.
Can I modify a VM once it is in a hibernated state?
No, once a VM is in a hibernated state, you cannot perform actions like resizing the VM and modifying the OS disk. Additionally, you cannot detach any disks or networking resources that are currently attached to the VM or attach new resources to the VM. You can however stop-deallocate or delete the VM if you want to detach these resources or perform disk operations.
What is the difference between deallocating and hibernating a VM?
When you stop(deallocate) a VM, the VM shuts down without persisting the memory contents. You can resize deallocated VMs as well as detach/attach disks and networking resources to the VM.
When you hibernate a VM, the memory contents are first persisted in the OS disk and then the VM hibernates. You cannot resize VMs in a hibernated state, nor detach/attach disks and networking resources to the VM.
Do ScaleSets support hibernation?
No, ScaleSets do not support hibernation.
Do Availability Sets support hibernation?
No, Availability Sets do not support hibernation.
Do Spot VMs support hibernation?
No, Spot VMs do not support hibernation.
What are the feature limitations during private preview?
During private preview, hibernate/resume should only be used for testing purposes and should not be used for production workloads. Additionally, the following items are not available:
CLI, PS and Portal are not available and will be offered when we announce public preview.
Hibernation is not supported on VMs with Accelerated Networking enabled. This will be supported in early 2022.
No SLAs are applicable when using this feature during private preview.
Customer support is not available for this feature. You can reach out to [email protected] if you run into issues or have questions or feedback on hibernate/resume.
How do I get support while trying out hibernate/resume?
You can reach out to [email protected] if you run into issues or have questions or feedback on hibernate/resume.
Appendix
Appendix A: Configure Guest OS to support hibernation for Linux VMs
To configure the guest OS to support hibernation for Linux VMs, you can install the hibernation-setup-tool (available here) on your VM.
wget https://github.com/microsoft/hibernation-setup-tool/releases/download/release-1.0-preview8/hibernation-setup-tool_1.0-8_amd64.deb
sudo apt install ./hibernation-setup-tool_1.0-8_amd64.deb
Once installed, you can check the status using this command:
systemctl status hibernation-setup-tool
A successful status should return “Inactive (dead)”, and the log messages should say that Swap file for
VM hibernation set up successfully
Sample response
azureuser@:~$ systemctl status hibernation-setup-tool
● hibernation-setup-tool.service - Hibernation Setup Tool
Loaded: loaded (/lib/systemd/system/hibernation-setup-tool.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2021-08-25 22:44:29 UTC; 17min ago
Process: 1131 ExecStart=/usr/sbin/hibernation-setup-tool (code=exited, status=0/SUCCESS)
Main PID: 1131 (code=exited, status=0/SUCCESS)
linuxhib2 hibernation-setup-tool[1131]: INFO: update-grub2 finished successfully.
linuxhib2 hibernation-setup-tool[1131]: INFO: udev rule to hibernate with systemd set up in /etc/udev/rules.d/99-vm-hibernation.rules. Telling udev about it.
linuxhib2 hibernation-setup-tool[1131]: INFO: Waiting for udevadm (pid 8312) to finish.
linuxhib2 hibernation-setup-tool[1131]: INFO: udevadm finished successfully.
linuxhib2 hibernation-setup-tool[1131]: INFO: Waiting for udevadm (pid 8313) to finish.
linuxhib2 hibernation-setup-tool[1131]: INFO: udevadm finished successfully.
linuxhib2 hibernation-setup-tool[1131]: INFO: Notifying systemd of new hooks
linuxhib2 hibernation-setup-tool[1131]: INFO: Waiting for systemctl (pid 8320) to finish.
linuxhib2 hibernation-setup-tool[1131]: INFO: systemctl finished successfully.
linuxhib2 hibernation-setup-tool[1131]: INFO: Swap file for VM hibernation set up successfully
You can then hibernate your VM using the deallocate API
POST
https://management.azure.com/subscriptions/.../providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate?hibernate=true&api-version=2021-03-01
When you start the VM back up, you can use the uptime command and see that the VM was hibernated and the session was persisted.
azureuser@linuxhib2:~$ uptime
23:34:44 up 50 min, 1 user, load average: 0.00, 0.00, 0.00
Additionally, you can create an image from this VM and use that image to create new VMs with hibernation enabled. For these new VMs, the guest OS will be automatically configured to support hibernation.
Appendix B: Moving the page file to the OS disk
You can use the below PS command to move the page file to OS disk. Additionally, you can also run this command via RunPowerShellScript available in Azure Run Commands.
Set-ItemProperty -path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -name "PagingFiles" -value "C:\pagefile.sys 16 100"