'How temporary is Azure VM Temporary Storage?
When you create an Azure VM, it creates a D: drive named "Temporary Storage". It's unclear to me just how temporary this is though. Is it reset between reboots, start/stop, or just if the image is recreated? Or arbitrarily? Also, what are some use cases for this temporary storage?
Solution 1:[1]
Resets, reboots, fail overs etc. can wipe it. It is only to be used for swap files etc.
Performance Best Practices for SQL Server in Azure Virtual Machines
Temporary Disk
The temporary storage drive, labeled as the D: drive is not persisted and is not saved in the Windows Azure Blob storage. It is used primarily for the page file and its performance is not guaranteed to be predictable. Management tasks such as a change to the virtual machine size, resets the D: drive. In addition, Windows Azure erases the data on the temporary storage drive when a virtual machine fails over. The D: drive is not recommended for storing any user or system database files, including tempdb.
EDIT: Interestingly enough the above has now been updated to the below which says that is OK to store your tempdb on if you are using the D-Series Virtual Machines.
The temporary storage drive, labeled as the D: drive, is not persisted to Azure blob storage. Do not store your data or log files on the D: drive. Only store tempdb and/or Buffer Pool Extensions on the D drive when using the D-Series Virtual Machines (VMs). Unlike the other VM series, the D drive in the D-Series VMs is SSD-based. This can improve the performance of workloads that heavily use temporary objects or that have working sets which don't fit in memory. For more information, see Using SSDs in Azure VMs to store SQL Server TempDB and Buffer Pool Extensions.
Some Azure Virtual Machine Basics Please
The Temporary storage drive is a local drive on the physical box that should only serve as scratch space. For example, we put the paging file onto this drive to save on transaction costs for each Windows page-in but nothing else. I would recommend you don’t put anything that you need persisted on this drive as it will be deleted upon any hardware failure the system sees whereas the OS disk and any data disks attached will remain persisted in storage even on hardware failures.
Solution 2:[2]
This disk is a local disk, non-replicated. If it crashes, anything on it is gone. If your VM is moved to another server, the content is gone. If you scale a VM size down, it's likely this data will be gone, as the allocation size decreases.
As for use cases: Think about database servers that need a scratch disk. Or maybe your workflow involves grabbing content from a blob, processing it, then shipping it off somewhere (e.g. photo/video/audio processing). You could download to temporary storage, do all of your transform work on that disk, then pick up the results, saving the final file somewhere durable. Temp storage use is really open-ended - it's really up to you how you use it; just realize that it's not durable storage (unlike your VHD, which is in durable storage).
Solution 3:[3]
When you resize the VM, When you shutdown or restart your VM, when your VM is moved to a different host server(due to service healing, shutdown and restart), when the host is updated, when the host experiences a hardware failure etc.
Source: Azure Pricing page
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | vsync |
Solution 2 | David Makogon |
Solution 3 | Phill Healey |