AZ-104Chapter 93 of 168Objective 3.1

Ephemeral OS Disks for VMs and AKS

This chapter covers ephemeral OS disks for Azure Virtual Machines (VMs) and Azure Kubernetes Service (AKS) nodes. Ephemeral OS disks provide a cost-effective, high-performance option for stateless workloads by storing the OS disk on the host's local SSD rather than Azure Storage. On the AZ-104 exam, expect 2-3 questions directly testing your understanding of ephemeral OS disks, particularly their limitations, supported VM sizes, placement requirements, and use cases. Mastery of this topic is essential for optimizing cost and performance in Azure compute scenarios.

25 min read
Intermediate
Updated May 31, 2026

Ephemeral OS Disks: Hotel Room Analogy

Imagine a hotel that offers two types of rooms: standard rooms with a personal safe for each guest, and economy rooms with a shared safe at the front desk. In a standard room, the safe is permanently installed and retains your valuables even after checkout, but you pay a nightly fee for it. In an economy room, there is no in-room safe; you must store your valuables in the shared safe, which is wiped clean after each guest leaves. The economy room is cheaper because the hotel doesn't need to maintain a safe in every room. Now, consider a developer who stays at the hotel for a conference. She brings her laptop, but she also uses the hotel's desktop computer in the business center. The desktop computer's hard drive is wiped after each user session, so she cannot save files locally—she must save them to the cloud or a USB drive. This is exactly how ephemeral OS disks work in Azure. The OS disk is stored on the host machine's local SSD, not on Azure Storage. When the VM is stopped (deallocated) or deleted, the disk is destroyed. Any data written to the OS disk is lost unless it is stored on a separate data disk or in a persistent location. This provides cost savings and performance benefits, but requires stateless application design. In contrast, managed OS disks are like the hotel room safe—they persist even when you leave the room, but you pay extra for that persistence.

How It Actually Works

What Are Ephemeral OS Disks?

Ephemeral OS disks are a type of OS disk for Azure VMs that are stored directly on the host machine's local SSD, rather than on Azure managed disks in Azure Storage. This means the OS disk is created on the same physical server that hosts the VM, providing significantly lower latency and higher IOPS compared to standard managed disks. However, because the disk is local, it is not durable—it is lost when the VM is stopped (deallocated) or deleted. Ephemeral OS disks are ideal for stateless workloads such as web servers, development/test environments, and AKS worker nodes, where any persistent data must be stored elsewhere (e.g., on separate data disks or in Azure Files).

How Ephemeral OS Disks Work Internally

When you create a VM with an ephemeral OS disk, Azure places the VM on a host that has a local SSD with enough free space to accommodate the OS disk size. The OS disk is carved from this local SSD and presented to the VM as a standard SCSI disk. The VM's operating system and all data on the C: drive (Windows) or root partition (Linux) reside on this local disk. Because the disk is local, read/write operations do not traverse the Azure Storage network, resulting in lower latency and higher throughput.

When the VM is stopped (deallocated) or deleted, Azure destroys the local OS disk. If the VM is restarted (not stopped and deallocated), the OS disk persists because the VM is simply rebooted on the same host. However, if the VM is stopped (deallocated) and then started again, Azure must provision a new host, and the original OS disk is gone. Similarly, if the underlying host fails, the OS disk is lost. Therefore, applications must be designed to handle this volatility.

Key Components, Values, Defaults, and Timers

VM Sizes: Not all VM sizes support ephemeral OS disks. Only VM sizes that have a local SSD cache or temporary disk can be used. Specifically, the VM size must have a cache size or temporary disk size that is at least as large as the OS disk size. For example, Standard_D2s_v3 has 8 GiB of cache, so it can support an ephemeral OS disk up to 8 GiB. The supported VM sizes are listed in Azure documentation and include most 's' series (e.g., Ds, Es, Fs) and many general-purpose sizes. VM sizes without local storage (e.g., some B-series) do not support ephemeral OS disks.

Placement: The ephemeral OS disk is placed in the cache slot of the VM. Typically, the VM's temporary disk (if present) is also on the local SSD, but the ephemeral OS disk occupies the cache space. This means you cannot use a managed disk cache when using an ephemeral OS disk; the cache space is repurposed for the OS disk.

OS Disk Size: The OS disk size must be equal to or less than the size of the local cache or temporary disk available on the VM size. For example, if the VM size has 8 GiB of cache, the OS disk can be up to 8 GiB. The default OS disk size for Windows Server is 127 GiB, but you can specify a smaller size (e.g., 30 GiB) to fit within the cache limit.

Storage Type: Ephemeral OS disks use the 'Ephemeral' storage type, not 'Standard_LRS' or 'Premium_LRS'. This is set in the Azure Resource Manager template or via CLI/PS.

Pricing: There is no additional cost for the ephemeral OS disk itself; you only pay for the VM compute and any persistent data disks. This can reduce costs by up to 20% compared to using a managed OS disk.

Data Persistence: Any data on the OS disk is lost on deallocation or deletion. Applications must save persistent data to separate data disks or Azure storage services.

Configuration and Verification Commands

To create a VM with an ephemeral OS disk using Azure CLI:

az vm create \
  --resource-group myResourceGroup \
  --name myVM \
  --image UbuntuLTS \
  --size Standard_DS2_v2 \
  --ephemeral-os-disk true \
  --ephemeral-os-disk-placement CacheDisk \
  --admin-username azureuser \
  --generate-ssh-keys

The --ephemeral-os-disk true flag enables the ephemeral OS disk. The --ephemeral-os-disk-placement can be CacheDisk (default) or ResourceDisk (temporary disk). Not all VM sizes support ResourceDisk placement.

To verify that a VM is using an ephemeral OS disk:

az vm show --resource-group myResourceGroup --name myVM --query 'storageProfile.osDisk' -o json

Look for "caching": "ReadOnly" or "caching": "None" and "createOption": "FromImage". The diffDiskSettings property will indicate option: "Local".

For PowerShell:

$vm = Get-AzVM -ResourceGroupName myResourceGroup -Name myVM
$vm.StorageProfile.OsDisk.DiffDiskSettings

If DiffDiskSettings.Option is Local, the OS disk is ephemeral.

Interaction with Related Technologies

Availability Sets and Virtual Machine Scale Sets: Ephemeral OS disks can be used in availability sets and scale sets. In scale sets, you can configure the OS disk type at creation time. For scale sets, the upgradePolicy must be set to Manual or Automatic; ephemeral disks work with both.

Azure Backup: Azure Backup does not support backing up ephemeral OS disks because the disk is not persistent. You must back up data from separate data disks or use application-level backups.

Azure Site Recovery: ASR does not support replication of ephemeral OS disks. VMs with ephemeral OS disks must be recreated in the secondary region.

Azure Disk Encryption: ADE is not supported on ephemeral OS disks because the disk is local and not managed by Azure Storage. Server-side encryption (SSE) with platform-managed keys is applied by default, but customer-managed keys (CMK) are not supported.

Azure Kubernetes Service (AKS): AKS supports ephemeral OS disks for node pools. This is a cost optimization for stateless worker nodes. When creating an AKS cluster, you can specify --enable-ephemeral-os-disk for the node pool. The node pool must use a VM size that supports ephemeral disks.

Performance Considerations

Ephemeral OS disks offer consistent, low-latency performance because they are local to the host. For I/O-intensive workloads, this can significantly improve boot times and application responsiveness. However, the performance is limited by the local SSD's capabilities, which vary by VM size. For example, Standard_DS2_v2 provides up to 3200 IOPS and 48 MB/s throughput for the local cache. In contrast, a standard managed OS disk (Premium SSD) might offer 2300 IOPS and 75 MB/s for a P10 disk. The ephemeral disk can outperform managed disks for random I/O patterns.

Limitations

No resizing: You cannot resize the OS disk of a VM with an ephemeral OS disk. If you need more space, you must delete and recreate the VM with a larger OS disk size (within the cache limit) or add a data disk.

No snapshot or image creation: You cannot create snapshots or images from an ephemeral OS disk. To capture a VM, you must first convert it to a managed OS disk or use a separate data disk.

No Azure Disk Encryption: As mentioned, ADE is not supported.

No Azure Backup: Backup is not supported.

Limited VM sizes: Only VM sizes with sufficient local cache or temporary disk are supported.

When to Use Ephemeral OS Disks

Stateless applications: Web servers, microservices, or any workload that doesn't require persistent OS data.

Dev/test environments: Where VMs are frequently created and destroyed.

AKS worker nodes: AKS node pools can use ephemeral OS disks to reduce costs and improve performance.

Scale sets: For stateless instances that are scaled out and in frequently.

When Not to Use Ephemeral OS Disks

Stateful applications: Databases, domain controllers, or any workload that requires persistent OS data.

Compliance requirements: If you need disk encryption with CMK or backup/DR capabilities.

Large OS disks: If your OS disk size exceeds the local cache capacity of the VM size.

Step-by-Step: Creating a VM with Ephemeral OS Disk

1.

Check VM size support: Use az vm list-skus --location eastus --resource-type virtualMachines --query '[?capabilities[?name=="EphemeralOSDiskSupported" && value=="True"]].name' to list supported sizes.

2.

Choose an image: Any Azure Marketplace image or custom image that fits within the cache size.

3.

Create the VM: Use CLI or PowerShell with the ephemeral flag. Ensure the OS disk size is less than or equal to the cache size.

4.

Verify: After creation, check the OS disk properties to confirm ephemeral is enabled.

5.

Deploy application: Ensure application data is stored on a separate data disk or in Azure Storage.

Common Exam Scenarios

Scenario: You need to reduce costs for a stateless web server farm. Solution: Use ephemeral OS disks. The exam may ask which VM size to choose; look for sizes with 's' suffix (e.g., D2s_v3).

Scenario: You need to back up a VM with an ephemeral OS disk. Answer: You cannot back up the OS disk; you must back up data disks separately.

Scenario: You need to resize the OS disk of a VM with an ephemeral disk. Answer: Not possible; you must recreate the VM.

Scenario: AKS node pool with ephemeral disks. Answer: Use --enable-ephemeral-os-disk and ensure the node size supports it.

Walk-Through

1

Determine VM Size Support

First, identify which VM sizes support ephemeral OS disks. Use the Azure CLI command `az vm list-skus --location <region> --resource-type virtualMachines --query '[?capabilities[?name=="EphemeralOSDiskSupported" && value=="True"]].name'` to get a list of supported sizes. Only sizes with a local cache or temporary disk of sufficient size (at least as large as the OS disk) are supported. For example, Standard_D2s_v3 has 8 GiB of cache, so it can support an ephemeral OS disk up to 8 GiB. Common supported series include Ds, Es, Fs, and Ls. VM sizes without local storage, such as B-series, are not supported. This step is critical because selecting an unsupported size will result in a creation error.

2

Select OS Image and Set Disk Size

Choose an OS image from Azure Marketplace or a custom image. The OS disk size must be equal to or less than the local cache or temporary disk size of the chosen VM size. For example, if using Standard_DS2_v2 (which has 86 GiB of cache), you can use the default 127 GiB OS disk only if the cache size is larger than 127 GiB—but DS2_v2 has only 86 GiB, so you must specify a smaller OS disk size. Use the `--os-disk-size-gb` parameter to set a custom size, e.g., 30 GiB. If the OS disk size exceeds the cache, the deployment will fail. For Windows images, the default is 127 GiB; for Linux, it varies. You can also use a custom image with a smaller OS disk.

3

Create VM with Ephemeral Flag

Deploy the VM using Azure CLI, PowerShell, or ARM template with the ephemeral OS disk flag. For CLI: `az vm create --resource-group myRG --name myVM --image UbuntuLTS --size Standard_DS2_v2 --ephemeral-os-disk true --ephemeral-os-disk-placement CacheDisk --admin-username azureuser --generate-ssh-keys`. The `--ephemeral-os-disk-placement` can be `CacheDisk` (uses the cache slot) or `ResourceDisk` (uses the temporary disk). Not all sizes support `ResourceDisk`. The placement affects performance and available space. During creation, Azure selects a host with sufficient free local SSD space. If no host is available, the deployment fails with a capacity error.

4

Verify Ephemeral OS Disk Configuration

After the VM is created, verify that the OS disk is indeed ephemeral. Use `az vm show --resource-group myRG --name myVM --query 'storageProfile.osDisk'` and check for `diffDiskSettings` with `option: "Local"`. Alternatively, in the portal, the OS disk will show 'Ephemeral' as the type. Also note that the caching setting will be 'ReadOnly' or 'None' because the cache is used for the OS disk. This verification is important for troubleshooting and for exam questions that ask how to confirm ephemeral disk usage.

5

Configure Application for Statelessness

Since the OS disk is ephemeral, any data written to the system drive (C: on Windows, / on Linux) will be lost on VM deallocation or deletion. Therefore, configure your application to store persistent data on a separate data disk (managed disk) or in Azure Storage (Blob, Files, etc.). For example, web server logs should be written to a data disk or Azure Monitor. For databases, use Azure SQL Database or a managed disk attached as a data disk. This design is essential for production workloads. In AKS, ensure that pods use persistent volumes for stateful data.

What This Looks Like on the Job

Enterprise Scenario 1: Stateless Web Farm for E-commerce

A large e-commerce company runs a stateless web application on Azure VMs behind a load balancer. The application is designed to be stateless, with session data stored in Azure Redis Cache and user uploads in Azure Blob Storage. The company wants to reduce costs without sacrificing performance. By using ephemeral OS disks for all web VMs, they save approximately 20% on storage costs (the cost of the managed OS disk is eliminated). Additionally, boot times decrease by 30% because the OS disk is local. During a flash sale, the auto-scaling rule triggers new VMs quickly. However, they must ensure that the VM size (e.g., Standard_D2s_v3) has sufficient cache for the OS disk (they use a custom image with a 30 GiB OS). They also configure Azure Monitor to alert if any VM is accidentally deallocated, as that would destroy the OS disk and require a fresh deployment. The main challenge is that they cannot use Azure Backup for the OS disk, so they rely on infrastructure-as-code (ARM templates) to redeploy VMs if needed.

Enterprise Scenario 2: AKS Cluster for Microservices

A SaaS provider runs a microservices architecture on AKS. To optimize cost, they use ephemeral OS disks for the agent nodes. They create a node pool with --enable-ephemeral-os-disk and choose a VM size like Standard_D4s_v3, which has 16 GiB of cache, sufficient for the default 30 GiB OS disk (they specify --node-osdisk-size 30). The ephemeral disks reduce node costs by 15% compared to managed disks. The application is designed with persistent volumes for stateful services (e.g., databases) and uses Azure Disks for persistent storage. The key consideration is that node OS updates require replacing nodes (since the OS disk is ephemeral), so they use AKS's node image upgrade feature to roll out new nodes. A common pitfall is forgetting that the OS disk is ephemeral and storing logs on the root partition; they redirect logs to a persistent volume. The exam may ask about the --enable-ephemeral-os-disk flag and the requirement that the node pool VM size supports ephemeral disks.

Enterprise Scenario 3: Dev/Test Environments for Rapid Prototyping

A software development team uses Azure VMs for daily builds and testing. They create and destroy dozens of VMs each day. Using ephemeral OS disks significantly reduces costs because they only pay for compute time and data disks (if any). They use a base image with a small OS disk (e.g., 30 GiB) to fit within the cache of a Standard_DS1_v2 (which has 7 GiB of cache? Actually DS1_v2 has 7 GiB cache, so they must use a smaller OS disk like 7 GiB or choose a larger size). They automate VM creation with Azure CLI scripts. The main issue is that if a build artifact is mistakenly saved to the OS disk, it is lost when the VM is deallocated. They enforce policies using Azure Policy to ensure that only ephemeral OS disks are used for dev VMs. This scenario is a classic exam example of cost optimization.

How AZ-104 Actually Tests This

What AZ-104 Tests on Ephemeral OS Disks

The AZ-104 exam objectives (Domain 3: Compute, Objective 3.1: Create and configure virtual machines) specifically include understanding ephemeral OS disks. Expect 2-3 questions that test your knowledge of:

The requirement that the VM size must have a local cache or temporary disk large enough to hold the OS disk.

The fact that ephemeral OS disks are not supported on VM sizes without local storage (e.g., B-series).

The behavior that the OS disk is lost when the VM is stopped (deallocated) or deleted.

The inability to use Azure Backup, Azure Site Recovery, or Azure Disk Encryption with ephemeral OS disks.

The use of --ephemeral-os-disk true in CLI or the diffDiskSettings property in ARM templates.

The placement options: CacheDisk (default) and ResourceDisk.

The cost savings: no charge for the OS disk itself.

Common Wrong Answers and Why Candidates Choose Them

1. Wrong Answer: "Ephemeral OS disks can be used with any VM size." Why: Candidates assume all VM sizes support ephemeral disks because they are a feature of the OS disk, not the VM. However, only sizes with local cache or temporary disk are supported. The exam will give a list of VM sizes and ask which can use ephemeral OS disks.

2. Wrong Answer: "You can resize the OS disk of a VM with an ephemeral OS disk." Why: Candidates think resizing is possible because it is possible with managed disks. But resizing is not supported; you must recreate the VM.

3. Wrong Answer: "Azure Backup can back up the ephemeral OS disk." Why: Candidates may think backup is always available. However, ephemeral disks are local and not durable, so Azure Backup does not support them.

4. Wrong Answer: "Ephemeral OS disks are persisted when the VM is stopped (deallocated)." Why: Candidates confuse 'stopped' with 'stopped (deallocated)'. If the VM is simply stopped (not deallocated), the disk persists. But 'stopped (deallocated)' releases the host, destroying the disk.

Specific Numbers, Values, and Terms

VM sizes: Look for 's' suffix (e.g., D2s_v3, E2s_v3). The cache size is listed in the VM size documentation.

OS disk size limit: Must be ≤ local cache size. Default OS disk sizes: Windows 127 GiB, Ubuntu 30 GiB.

Placement: CacheDisk (uses cache) or ResourceDisk (uses temporary disk).

CLI parameter: --ephemeral-os-disk true.

PowerShell: -DiffDiskSetting with -Option Local.

ARM property: "diffDiskSettings": { "option": "Local" }.

Edge Cases and Exceptions

VM with no cache but has temporary disk: Some sizes have a temporary disk but no cache (e.g., L-series). These support ephemeral OS disks with ResourceDisk placement.

VM with both cache and temporary disk: Both placements are possible, but CacheDisk is default.

Ephemeral OS disk with Azure Kubernetes Service: AKS node pools can use ephemeral OS disks, but the node pool must be created with the flag; you cannot convert an existing node pool.

Ephemeral OS disk in availability sets: Supported, but all VMs in the set must use the same VM size with sufficient cache.

How to Eliminate Wrong Answers

If the question mentions backup, DR, encryption, or resizing, eliminate any answer that suggests those are possible with ephemeral OS disks.

If the question asks for cost reduction, look for the option that uses ephemeral OS disks.

If the question lists VM sizes, eliminate any size without local storage (e.g., B2s, B4ms).

If the question says "stopped" without "deallocated", remember that the OS disk persists if the VM is just stopped (not deallocated).

For AKS, look for --enable-ephemeral-os-disk and ensure the node size supports it.

Key Takeaways

Ephemeral OS disks are stored on the host's local SSD, not Azure Storage, and are lost when the VM is stopped (deallocated) or deleted.

Only VM sizes with local cache or temporary disk (e.g., Ds, Es, Fs series) support ephemeral OS disks.

The OS disk size must be ≤ the local cache or temporary disk size of the VM size.

Azure Backup, Azure Site Recovery, and Azure Disk Encryption are not supported with ephemeral OS disks.

Ephemeral OS disks are ideal for stateless workloads like web servers, dev/test, and AKS node pools.

To create a VM with an ephemeral OS disk, use `--ephemeral-os-disk true` in Azure CLI or set `diffDiskSettings` in ARM templates.

Resizing the OS disk or creating snapshots/images from an ephemeral OS disk is not supported.

Ephemeral OS disks can reduce costs by up to 20% compared to managed OS disks.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Ephemeral OS Disk

Stored on host local SSD; lost on deallocation/deletion.

No additional cost for the OS disk; pay only for compute.

Higher performance due to local storage; lower latency.

Cannot be backed up, replicated, or encrypted with ADE.

OS disk size limited by host cache/temp disk size.

Managed OS Disk

Stored in Azure Storage; persists across deallocations.

Pay for the managed disk (Standard or Premium) separately.

Performance depends on disk type; higher latency than local.

Supports Azure Backup, Site Recovery, and Disk Encryption.

Can be any size up to 4 TiB; resizable.

Watch Out for These

Mistake

Ephemeral OS disks are stored on Azure managed disks.

Correct

Ephemeral OS disks are stored on the host machine's local SSD, not on Azure managed disks in Azure Storage. This is why they are lost when the VM is deallocated.

Mistake

You can use Azure Backup to protect a VM with an ephemeral OS disk.

Correct

Azure Backup does not support backing up ephemeral OS disks because the disk is not persistent. You must back up data from separate data disks or use application-level backups.

Mistake

Ephemeral OS disks are supported on all VM sizes.

Correct

Only VM sizes that have a local cache or temporary disk of sufficient size support ephemeral OS disks. For example, B-series VMs do not support them.

Mistake

If a VM with an ephemeral OS disk is stopped (not deallocated), the OS disk is lost.

Correct

If the VM is stopped (not deallocated), the host is not released, and the OS disk persists. It is only lost when the VM is stopped (deallocated) or deleted.

Mistake

You can resize the OS disk of a VM with an ephemeral OS disk.

Correct

Resizing the OS disk is not supported for ephemeral OS disks. To change the size, you must delete and recreate the VM with a new OS disk size that fits within the cache limit.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

What happens to the OS disk when I stop (deallocate) a VM with an ephemeral OS disk?

When you stop (deallocate) a VM, Azure releases the host resources, and the local SSD where the ephemeral OS disk resides is reclaimed. The OS disk is destroyed, and all data on it is lost. If you start the VM again, Azure provisions a new host and creates a fresh OS disk from the image. To avoid data loss, ensure any persistent data is stored on a separate data disk or in Azure Storage.

Can I convert a VM with a managed OS disk to use an ephemeral OS disk?

No, you cannot convert an existing VM. You must create a new VM with the ephemeral OS disk option. You can, however, capture an image of the existing VM (using a data disk) and use that image to create a new VM with an ephemeral OS disk.

Which VM sizes support ephemeral OS disks?

Only VM sizes that have a local cache or temporary disk of sufficient size support ephemeral OS disks. Examples include Ds_v3, Es_v3, Fs_v2, Ls_v2 series. B-series and some other sizes without local storage do not support them. Use `az vm list-skus` with the filter for `EphemeralOSDiskSupported` to check.

Can I use Azure Disk Encryption with an ephemeral OS disk?

No, Azure Disk Encryption (ADE) is not supported on ephemeral OS disks because the disk is local and not managed by Azure Storage. Server-side encryption (SSE) with platform-managed keys is applied by default, but customer-managed keys (CMK) are not supported.

How do I create an AKS node pool with ephemeral OS disks?

When creating an AKS cluster or adding a node pool, use the `--enable-ephemeral-os-disk` flag with the `az aks create` or `az aks nodepool add` command. Ensure the node pool VM size supports ephemeral OS disks. For example: `az aks nodepool add --resource-group myRG --cluster-name myAKS --name ephnp --node-count 3 --enable-ephemeral-os-disk --node-vm-size Standard_DS2_v2`.

What is the cost benefit of using ephemeral OS disks?

Ephemeral OS disks eliminate the cost of the managed OS disk. You only pay for the VM compute and any additional data disks. This can reduce the overall cost of a VM by up to 20%, depending on the OS disk size and type. For stateless workloads, this is a significant saving.

Can I take a snapshot of an ephemeral OS disk?

No, snapshots are not supported for ephemeral OS disks. To capture the state of a VM, you must either use a separate data disk to store persistent data or create a new VM from the original image.

Terms Worth Knowing

Ready to put this to the test?

You've just covered Ephemeral OS Disks for VMs and AKS — now see how well it sticks with free AZ-104 practice questions. Full explanations included, no account needed.

Done with this chapter?