Search code examples
azureazure-storageazure-virtual-machine

Web app deployed on Azure Virtual Machine: persistent VS temporary disk


I have deployed a web application backend (Python / Flask) on an Azure Virtual Machine by performing the following steps:

  1. create a Linux VM and ssh into it
  2. download my application's source code from github
  3. install pip, create a Python 3.6 virtual environment and install all necessary Python packages
  4. install tmux and create a new tmux session, then cd to the folder containing my app's main script (the one launching the Flask app) and run "python3 main.py". The Flask app is now up and running and can receive requests.

However, based on what I read about temporary VS persistent disk, I guess my source code and Python packages are now stored on temporary disk, which means they could be lost unexpectedly due to hardware failures, maintenance events etc. Is my guess correct or am I missing something?

If so, does this mean that I have to attach a persistent disk to my VM and store all my files there? Or is there some more convenient way to tackle the issue (e.g. switching to a different Azure service)?


Solution

  • You can get the message here that the temporary disk on Linux is /dev/sdb, and you can execute the command df -h then you will see the output like this:

    enter image description here

    It means only the folders under the path /mnt/ are stored in the temporary disk. And you can also get it that all the folders under the path / are stored in the disk /dev/sda, it's the OS disk and a managed disk, os it's the persistent disk.

    does this mean that I have to attach a persistent disk to my VM and store all my files there?

    If you do not have a special purpose, then you do not have to attach a persistent disk to your VM.