> 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/knowledge-base/zh/virtual-machines/import-vms-from-files.md).

# 从文件导入虚拟机

通过文件导入，您可以通过将 VM 数据文件（如 VMX、VMDK、OVF、VHD/X）上传到 VergeOS，然后选择它们进行导入，一次导入一台虚拟机。

## 从文件导入虚拟机（配置和磁盘）

{% hint style="info" %}
**Hyper-V 虚拟机**

Hyper-V 虚拟机应在上传前导出为 OVA/OVF 或 VMware 格式，或者您也可以使用下面介绍的 **创建虚拟机外壳，导入虚拟机磁盘** 方法先创建虚拟机，然后导入磁盘。
{% endhint %}

1. 将配置和磁盘映像文件上传到 vSAN。有关说明，请参见 [管理文件](/knowledge-base/zh/virtual-machines/managing-files.md).
2. 点击 **虚拟机** 中的顶部菜单。
3. 选择 **+ 新建虚拟机**.
4. 从选项列表中，选择 **--从文件导入--**。上传到 vSAN 的文件将显示在右侧的 **可用选择项**下。单击以选择虚拟机配置文件（例如 \*.vmx、\*.ovf）。
5. 点击 **下一步** 在屏幕底部。
6. 该 **虚拟机名称** 将默认使用配置文件的名称，除非您指定自定义名称。
7. 默认情况下， **保留 MAC 地址** 选项已被选中。如果您希望为虚拟机分配新的 MAC 地址，请取消选择此选项。
8. 选择 **首选层级**，或保持默认设置。这将指定虚拟机磁盘的存储层级。有关详细信息，请参见 [首选层级的使用](/knowledge-base/zh/storage-vsan/preferred-tier-usage.md) 。
9. 点击 **提交** 来创建虚拟机。新的虚拟机仪表板将显示出来。

## 创建虚拟机外壳，导入虚拟机磁盘

如果您无法导入整个配置，可以创建一个 **虚拟机外壳** （无磁盘的虚拟机），然后导入单个磁盘文件。

1. 将磁盘映像文件上传到 vSAN。详情请参见 [管理文件](/knowledge-base/zh/virtual-machines/managing-files.md) 。
2. 创建一个新的 **自定义虚拟机** 并使用适当的硬件规格。请参见 VergeOS 帮助指南中的 **创建虚拟机** 部分。
3. 向虚拟机添加一个新驱动器，确保您在 **导入磁盘** 文件字段中进行选择。
4. 选择正确的 **接口** （IDE、SATA、virtio-scsi、virtio-legacy 等）。使用 **SATA** 通常有助于解决来宾操作系统中的驱动程序兼容性问题。
5. 选择 **文件** 从已上传文件列表中选择（\*.vhd、\*.vhdx、\*.qcow、raw 等）。
6. 如有必要，对其他驱动器重复此操作。
7. 启动虚拟机并验证其是否能正确引导。

{% hint style="info" %}
**支持的文件类型**

使用文件导入虚拟机时，支持以下文件类型：

* IMG（原始磁盘映像）
* RAW（二进制磁盘映像）
* QCOW（旧版 QEMU）
* QCOW2（QEMU、Xen）
* VDI（VirtualBox）
* VHD/VPC（旧版 Hyper-V）
* VHDX（Hyper-V）
* OVA（VMware、VirtualBox）
* OVF（VMware、VirtualBox）
* VMDK（VMware）
* VMX（VMware）
  {% endhint %}

## 问题排查

### 无法启动进入操作系统

这通常是驱动程序问题。您可能会遇到 **Windows 无法访问启动设备** 错误或类似问题。

**解决步骤：**

1. 将驱动器接口从 **virtio-scsi** 更改为 **IDE** 或 **SATA**。这通常可以解决驱动程序问题。
2. 一旦来宾操作系统启动，请安装 **virtio 驱动程序** ，方法是通过虚拟 CD-ROM 挂载它们，或者从 [virtio-win](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso).
3. 关闭虚拟机。
4. 将驱动器接口切换回 **virtio-scsi**.
5. 再次启动虚拟机。

***

{% hint style="info" %}
**文档信息**

* 最后更新：2024-08-29
* vergeOS 版本：4.12.6
  {% endhint %}


---

# 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/knowledge-base/zh/virtual-machines/import-vms-from-files.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.
