> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/learn-the-platform/zh/mo-kuai-6-xu-ni-ji/lab.md).

# 实验：虚拟机操作

## 目标

在 VergeOS 中执行核心虚拟机操作，包括手动创建 VM、基于配方的部署、GPU 直通配置，以及从外部平台导入 VM。

## 前置条件

* 已完成模块 1：架构基础
* 已完成第 4 模块：网络
* 已完成第 5 模块：存储
* 已完成第 6 模块阅读（VM 创建、配方与模板、GPU 直通、VM 迁移）
* 一个正在运行的 VergeOS 集群，具备可用的计算和存储资源

## 难度

**中级** -- 需要理解虚拟化概念（CPU、内存、磁盘、网络）

## 预计时间

**1.5 小时**

## 步骤

### 第 1 部分：VM 创建与生命周期

从零创建一台虚拟机并执行生命周期操作。

1. 进入 VergeOS 界面中的 Virtual Machines（虚拟机）部分
2. 使用以下配置创建一台新 VM：
   * 名称：“lab-vm-01”
   * CPU：2 个 vCPU
   * 内存：4 GB
   * 磁盘：在你首选的存储层上分配 40 GB
   * 网络：连接到现有内部网络
3. 挂载 ISO 并安装来宾操作系统
4. 执行生命周期操作：
   * 对正在运行的 VM 创建快照
   * 克隆 VM 以创建“lab-vm-02”
   * 停止、启动并重启克隆的 VM
5. 验证两台 VM 都在运行并可在网络中访问

### 第 2 部分：基于配方的部署

使用预构建配方部署一台 VM，以实现标准化配置。

1. 浏览 VergeOS 配方目录中可用的 VM 配方
2. 选择适合你环境的配方（例如 Linux 服务器模板）
3. 从配方部署一台新 VM：
   * 自定义 VM 名称和资源分配
   * 在部署前检查配方定义的配置
4. 验证已部署的 VM 是否符合配方规格
5. 比较通过配方部署的 VM 与你手动创建的 VM

### 第 3 部分：GPU 直通（可选）

为计算密集型工作负载配置 GPU 直通。

1. 在 VergeOS 硬件清单中识别可用的 GPU 设备
2. 为 GPU 设备配置 PCI 直通：
   * 选择要分配 GPU 的目标 VM
   * 将 GPU 设备分配给该 VM
3. 启动 VM 并验证来宾操作系统已识别该 GPU
4. 在来宾操作系统中安装适当的 GPU 驱动程序
5. 通过基本测试验证 GPU 功能（例如，查询 GPU 信息）

> **注意：** 本节需要集群中具备物理 GPU 硬件。如果没有可用 GPU，请跳过。

### 第 4 部分：从 VMware 导入 VM

从外部平台导入一台虚拟机。

1. 准备来自 VMware（OVA/VMDK）或其他虚拟化管理程序的 VM 导出文件
2. 使用 VergeOS 导入工具将 VM 引入平台：
   * 上传 VM 映像
   * 映射虚拟硬件（CPU、内存、磁盘、网络）
   * 检查并调整导入配置
3. 启动已导入的虚拟机，并验证它能成功启动
4. 验证网络连接和应用功能
5. 比较导入的 VM 与原生 VergeOS VM 之间的性能指标

## 验证

当你能够回答以下问题时，你的 VM 实验室就完成了 **是** 时，你的 VMware 迁移实验就完成了：

* [ ] 已手动创建一台 VM，并指定了 CPU、内存、磁盘和网络设置
* [ ] 已成功执行快照和克隆操作
* [ ] 已从配方部署一台配置正确的 VM
* [ ] 已配置 GPU 直通（如果没有 GPU 硬件，则已说明理由并跳过）
* [ ] 已从外部格式导入一台 VM，并且能够成功启动
* [ ] 所有 VM 都可在网络上访问并按预期运行


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verge.io/learn-the-platform/zh/mo-kuai-6-xu-ni-ji/lab.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
