mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-09-01 06:22:52 +08:00
update 4.PVE制作虚拟机模板.md.
This commit is contained in:
@@ -77,3 +77,69 @@ CPU类别选择 `host` ,核心根据物理 CPU 核心数进行酌情设置,
|
|||||||
接下来查看设置总览,确认无误,即可点击 “完成” :
|
接下来查看设置总览,确认无误,即可点击 “完成” :
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## 2.调整虚拟机硬件参数
|
||||||
|
|
||||||
|
### 2.1.删除虚拟机光驱
|
||||||
|
|
||||||
|
此时,查看虚拟机详情页,可以看到我们刚才创建的 Debian 虚拟机,删除 `CD/DVD驱动器` :
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 2.2.虚拟机导入磁盘镜像
|
||||||
|
|
||||||
|
使用 SSH 工具登录 PVE 服务器,并进入 `tmp` 目录,创建一个文件夹:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 进入 tmp 目录
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
|
# 创建文件夹
|
||||||
|
mkdir Debian
|
||||||
|
|
||||||
|
# 进入文件夹
|
||||||
|
cd Debian
|
||||||
|
```
|
||||||
|
|
||||||
|
将 Debian 云镜像 `debian-11-genericcloud-amd64.qcow2` 上传到该文件夹中,并检查 `hash` :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 检查文件是否存在
|
||||||
|
ls -la
|
||||||
|
|
||||||
|
# 计算文件 hash
|
||||||
|
sha512sum debian-11-genericcloud-amd64.qcow2
|
||||||
|
```
|
||||||
|
|
||||||
|
确认无误后,将 Debian 云镜像导入刚才创建的虚拟机中,命令中的 `VM ID` 需要根据实际情况替换,演示为 `1000` :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 将 qcow2 镜像导入虚拟机中
|
||||||
|
qm importdisk 1000 debian-11-genericcloud-amd64.qcow2 local-lvm
|
||||||
|
|
||||||
|
# 输出结果为以下类似内容表示成功
|
||||||
|
Successfully imported disk as 'unused0:local-lvm:vm-1000-disk-1'
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
鼠标 **双击** 该未使用的磁盘,勾选 `IO thread` ,点击添加按钮:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
刚导入的磁盘只有 `2G` 磁盘空间,为了后续方便使用,先给磁盘扩容 `16G` 的磁盘空间。
|
||||||
|
|
||||||
|
选择 `Disk Action` 菜单的子菜单 `Resize` :
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
在弹出的对话框中,给该磁盘增加 `16G` 的磁盘容量:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 2.3.虚拟机添加CloudInit设备
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 174 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 163 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 176 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
Reference in New Issue
Block a user