Azure Files mounted on Ubuntu fail after starting VM

2021-02-15T17:33:00.85+00:00

Hi,

I have followed this tutorial and mounted Azure Files in Ubuntu persistently with /etc/fstab

https://learn.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-linux

My VM's at Azure are normally stop. I find out that sometimes when I start them for the first time the mount does not have the Azure Files. If I restart the VM, the problem normally disappears.

What can be the issue here?

Thanks in advance,

Francesc

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,170 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,185 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. 2021-02-17T17:14:34.86+00:00

    @deherman-MSFT

    Thanks. I am using Linux (ubuntu 18.04) and this is my fstab:

    CLOUD_IMG: This file was created/modified by the Cloud Image build process

    UUID=8c0a4742-2f51-40b4-b659-357cfb0bb2a3 / ext4 defaults,discard 0 0
    UUID=5BCE-FF6A /boot/efi vfat defaults,discard 0 0
    //evokerstorageuser.file.core.windows.net/3dsamples /mnt/evokerstorageuser/3dsamples cifs nofail,uid=azureuser,file_mode=0777,dir_mode=0777,vers=3.0,credentials=/etc/smbcredentials/evokerstorageuser.cred,serverino
    x-systemd.automount
    /dev/disk/cloud/azure_resource-part1 /mnt auto defaults,nofail,x-systemd.requires=cloud-init.service,comment=cloudconfig 0 2

    1 person found this answer helpful.
    0 comments No comments

  2. deherman-MSFT 33,701 Reputation points Microsoft Employee
    2021-02-16T19:24:18.13+00:00

    @Costa, Francesc (Color and Imaging Barcelona)
    Since you are using Ubuntu you can try adding the option x-systemd.automount to /etc/fstab. If you are using an older version of Ubuntu you can try using _netdev. For some discussion on this issue you can checkout this StackExchange thread.

    Hope this helps. Let me know if you are still facing issues or have further questions.

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

  3. 2021-02-17T05:53:43.987+00:00

    Thanks @deherman-MSFT

    I have added x-systemd.automount as a separate line in /etc/fstab but still the Azure Files don't get mounted at start-up.

    I also have run this:

    After adding x-systemd.automount to an fstab line, you need to run:  
    
    sudo systemctl daemon-reload  
    
    and then one, or both, of the following:  
    
    sudo systemctl restart remote-fs.target  
    sudo systemctl restart local-fs.target  
    
    only then will the automount become active.  
    

    but the Azure Files do not get mounted.

    What else can I do?

    Why do they get mounted with restart the VM but not with start?

    Francesc


  4. Dmitry Kutetsky 1 Reputation point
    2021-04-09T13:55:22.113+00:00

    @Costa, Francesc (Color and Imaging Barcelona) , the /mnt directory are used by Azure/cloud-init as ephemeral storage as you can see in a fstab.
    As the simplest option, you can try mounting your share in another directory, like /data.

    0 comments No comments