By using ephemeral OS disks, you can reduce the cost of storage, increase the speed of the boot process, and improve the performance of your stateless VMs. This is because ephemeral OS disks are stored on the local storage of the VM’s host, rather than on a remote storage solution, like Azure Disk Storage. Additionally, they are automatically created and managed by Azure, which eliminates the need to manually create and manage storage accounts.
Ephemeral OS disks in Azure are temporary storage disks that are associated with a virtual machine (VM) and deliver lower read/write latency to the OS disk and faster VM reimage. They are designed for stateless VMs, which means that their data is not persisted after the VM is deleted or restarted.
It’s important to note that ephemeral OS disks are not recommended for stateful VMs, as their data will be lost if the VM is deleted or restarted. In these cases, you should use a persistent storage solution like Azure Disk Storage.
Create the Stateless VM
The process to create such disks involves advanced disk configuration as part of the usual VM creation process. For example under the Disks tab, click Advanced and select Yes for “Use ephemeral OS disk” followed by Click Review + create, then Create to complete the process.
Reimage the VM
This process results in the contents of such Ephemeral OS disks being discarded.
From the main VM page in the azure portal Click the Reimage button and confirm.
Once the reimaging is complete and you log in to the VM, your previous changes will not be there and for example files you saved will not be present, as the VM has been returned to a clean state, and the reimage has succeeded.