简体   繁体   English

无法将数据添加到 Azure /dev/sdb1

[英]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.stack.imgur.com/zKXmQ.png )我在 linux 上访问我的 Azure 虚拟机。使用df -kh ,我可以看到我的 /dev/sdb1 临时磁盘 ( https://i.stack.imgur.com/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.我想用它来存储数据,但是,尽管谷歌搜索并阅读了 Azure 文档,但我没有找到向其中添加数据的任何方法。

  • cp test /dev/sdb1 cp: cannot create regular file '/dev/sdb1': Permission denied cp test /dev/sdb1 cp: 无法创建常规文件 '/dev/sdb1': 权限被拒绝
  • sudo cp test /dev/sdb1 sudo: unable to resolve host HubertProduction: Temporary failure in name resolution sudo cp test /dev/sdb1 sudo:无法解析主机 HubertProduction:名称解析暂时失败
  • mkdir /dev/sdb1/TEST mkdir: cannot create directory '/dev/sdb1/TEST': Not a directory mkdir /dev/sdb1/TEST mkdir: 无法创建目录 '/dev/sdb1/TEST': 不是目录

How can I use /dev/sdb1 to store data and access to them?我如何使用 /dev/sdb1 来存储数据和访问它们? 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.我找到的所有帖子都是关于这是一个没有备份的临时存储这一事实:我理解,这不是这里的问题。

I created one Linux Ubuntu VM and created one directory and mounted it on sdb1 temporary disk like below我创建了一个 Linux Ubuntu VM 并创建了一个目录并将其挂载到 sdb1 临时磁盘上,如下所示

Without sudo:-没有须藤: -

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

With sudo, It worked:-使用 sudo,它起作用了:-

sudo mkdir /data2

Mounted dir data2 on sdb1在 sdb1 上挂载目录 data2

sudo mount /dev/sdb1 /data2
cd /data2

Accessed data2访问数据2

siliconuser@siliconvm:/data2$ lsblk

在此处输入图像描述

Now you can directly create files in /data2 and those files will be stored in the temporary disk sdb1现在您可以直接在/data2 中创建文件,这些文件将存储在临时磁盘sdb1 中

Refer below:-参考以下:-

在此处输入图像描述

You do not need to format the disk as it is already mounted on Azure Linux VM.您不需要格式化磁盘,因为它已经安装在 Azure Linux VM 上。 But you can change its mounted directory from mnt to dir.但是你可以将其挂载目录从 mnt 更改为 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:-您可以通过移动到 /mnt 目录来创建文件,在创建虚拟机后默认安装临时磁盘 sdb1,而无需将 sdb1 挂载到另一个目录:-
Refer below:-参考以下:-

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

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.它还显示 DATALOSS_WARNING 自述文件,该文件声明在此目录下创建的文件将被删除,因为这是一个临时磁盘。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM