which drive has persistent files

Justin Mierzejewski 20 Reputation points
2025-05-12T13:45:32.9+00:00

I see a C: (Temporary Storage) and a D: (Windows) drive on my Cloud Services VM. I need a place to put persistent files for use with my Web App. Which of these drives should I use for that purpose? I have recently seen files deleted from D: (Windows). However, I am concerned about putting anything on C: (Temporary Storage) as typically that data cannot be guaranteed to persist. Thank you!

Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
774 questions
{count} votes

Accepted answer
  1. Michael Taylor 60,326 Reputation points
    2025-05-12T14:03:15.2333333+00:00

    You didn't clarify what specific Azure service you're using. It sounds like you're using Azure App Services. In that case your app is running in a VM/container that is managed by Azure. As such the D: drive is going to get reset whenever the service starts up. The C: is for you to store data while the service is running. Neither can be used to persist data across service restarts.

    Static content, like images and whatnot, should be part of your app's deployment. That structure is restored when your service is started. If you need to dynamically save files and have them persist across service runs then you're going to need to use storage. Depends on what you are running and what you need to persist to determine that. At the high end is setting up a storage account. You can then store whatever you need in a blob and your app can read/write as needed. This is the closest to a regular file system as you'll get with AAS. You can mount the storage as a local drive so your app is none the wiser. Refer to this article on how to do that.

    If you're running an actual VM then you can add additional drives as data drives to your VM like you could anything else.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Mounika Reddy Anumandla 6,850 Reputation points Microsoft External Staff Moderator
    2025-05-12T14:17:37.4566667+00:00

    Justin Mierzejewski

    Your understanding is correct. In your Azure Cloud Services VM environment, neither the C: (Temporary Storage) nor the D: (Windows) drive is persistent:

    • C: (Temporary Storage): Backed by the physical host's local disk; data is lost during VM reboots, migrations, or updates.
    • D: (Windows): Used for the OS and role deployments; data is overwritten during reimaging or re-deployment of your Cloud Service.

    Option 1: Attach a Persistent Data Disk
    Managed disks simplify disk management by handling the storage for you. Managed disks don't require a storage account. You specify the size and type of disk and it's deployed as a highly available resource. Managed disks also offer cost optimization by providing desired performance without the need for over-provisioning, accounting for fluctuating workload patterns, and minimizing unused provisioned capacity.

    The OS disk is a VHD stored in Azure Storage, so it persists even when the host machine is down. We also recommend creating one or more data disks, which are persistent VHDs used for application data.
    https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/n-tier/linux-vm#disks
    https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/n-tier/windows-vm#disks

    Option 2: Use Azure Storage Services

    Azure Blob Storage: For storing unstructured data like files and logs.

    Azure Files: Provides SMB file shares you can mount to the VM.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.