Search code examples
linuxazurestorage

Cannot add data to Azure /dev/sdb1


I access my Azure VM on linux. Using df -kh, I can see my /dev/sdb1 temporary disk (https://i.sstatic.net/zKXmQ.png)

$ sudo -i blkid
...
/dev/sdb1: PARTUUID="7ec06285-01"
...

I want to use it to store data however, despite, googling and reading the Azure documentation, I did not find any way to add data to it.

  • cp test /dev/sdb1 cp: cannot create regular file '/dev/sdb1': Permission denied
  • sudo cp test /dev/sdb1 sudo: unable to resolve host HubertProduction: Temporary failure in name resolution
  • mkdir /dev/sdb1/TEST mkdir: cannot create directory ‘/dev/sdb1/TEST’: Not a directory

How can I use /dev/sdb1 to store data and access to them? It is mounted so do I need to format it? if so how?

All the post I found are about the fact this is a temp storage with no backup: I understand it and this is not the issue here.


Solution

  • I created one Linux Ubuntu VM and created one directory and mounted it on sdb1 temporary disk like below

    Without sudo :-

    mkdir /data2
    mkdir: cannot create directory ‘/data2’: Permission denied
    

    With sudo, It worked:-

    sudo mkdir /data2
    

    Mounted dir data2 on sdb1

    sudo mount /dev/sdb1 /data2
    cd /data2
    

    Accessed data2

    siliconuser@siliconvm:/data2$ lsblk
    

    enter image description here

    Now you can directly create files in /data2 and those files will be stored in the temporary disk sdb1

    Refer below :-

    enter image description here

    You do not need to format the disk as it is already mounted on Azure Linux VM. But you can change its mounted directory from mnt to dir.

    You can create the file by moving to /mnt directory where temporary disk sdb1 is mounted by default after vm creation without a need to mount sdb1 to another directory :-
    Refer below :-

    enter image description here

    enter image description here

    enter image description here

    Its also showing DATALOSS_WARNING readme file which states that the files created under this directory will be deleted as this is a temporary disk.

    Reference :-
    https://amalgjose.com/2021/09/01/how-to-add-a-new-disk-to-a-linux-server-without-downtime-or-reboot/