惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 衡子

Ubuntu24.04更改SSH端口 记录安装过程 - 衡子 Azure CLI创建管理员用户 创建VMSS中的instance 创建不带公网IP的VM Azure AD访问Azure Storage Azure Linux VM使用Managed Identity获取Key-vault的Secret Azure AD SSO with Google Cloud Identity 通过VM SWAP OS DISK升级VM 通过API获取Azure KeyVault Securet Azure Front Door添加自定义域名 VM间网络PPS和带宽测试 Azure获取access token的方法 VM间记录时延 Windows Terminal的一些配置 安装hping Azure解除不再使用Directory的关联 使用VSCode Remote Containers功能实现开发环境统一 Azure AKS容器网络详解
Azure LSv3系列VM 自动挂载NVMe本地磁盘
衡子 · 2022-08-16 · via 博客园 - 衡子

Azure 的Lsv3 系列虚拟机具有高吞吐量、低延迟、直接映射的本地 NVMe 存储。 这些 VM 采用第三代 Intel® Xeon® Platinum 8370C (Ice Lake) 处理器。Lsv3 系列 VM 的规格从 8 到 80 个 vCPU 不等。 每个 vCPU 分配了 8 GiB 内存,每 8 个 vCPU 分配一个 1.92TB 的 NVMe SSD 设备。如下表:

大小

vCPU

本地NVMe容量

NVMe性能读取IOPS/MBps

最大云盘数量

网络带宽Gbps

L8s_v3

8

1x1.92TB

400000/2000

16

12.5

L16s_v3

16

2x1.92TB

800000/4000

32

12.5

L32s_v3

32

4x1.92TB

1.5M/8000

32

16

L48s_v3

48

5x1.92TB

2.2M/14000

32

24

L64s_v3

64

8x1.92TB

2.9M/16000

32

30

L80s_v3

80

10x1.92TB

3.8M/20000

32

32

由于NVMe是本地盘,在机器关机等动作时,会造成VM被重新分配到新的硬件上。在每次VM停机-启动后,Disk是新的NVMe盘,需要重新挂载。

这里介绍两种方式,在VM重新启动后,自动挂载。

1 采用服务的模式

创建格式化、挂载脚本,位于目录/usr/bin/mystart.sh

如果挂载点不存在,创建挂载目录;如果disk没有格式化,格式化disk并挂载,并做相应的记录:

#!/bin/sh
echo "written via startup-script" + $(date) >> /tmp/myScript.txt
[ -d /data ] || mkdir /data
sudo mount /dev/nvme0n1 /data
ret=$?
if [ $ret -ne 0 ]; then
        sudo mkfs.xfs -f /dev/nvme0n1
        sudo mount /dev/nvme0n1 /data
        echo "format and mount to the folder" >> /tmp/myScript.txt
else
        echo "mount success" >> /tmp/myScript.txt
fi

在/etc/system/system/目录下创建服务文件:

cat /etc/systemd/system/my-service.service

[Unit]
Description=My custom startup script

[Service]
ExecStart=/usr/bin/mystart.sh start

[Install]
WantedBy=multi-user.target

创建完成后,创建开机启动项,并启动服务:

systemctl enable my-service
systemctl start my-service


2 采用crontab中定义启动脚本模式

编辑crontab:

@reboot /usr/bin/mystart.sh

每次启动时,都运行此脚本。

3 检查

前面介绍的两种情况,分别在portal上stop VM,再start VM,模拟底层硬件更换场景,启动后,查看disk挂载情况:

 

查看脚本的日志:

 

如果在VM内部重启,VM不更换底层硬件,磁盘上的内容应该保留: