> 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/vm-disk-discard.md).

# 虚拟机磁盘丢弃

该 **丢弃** VergeOS 中 VM 磁盘上的选项负责通过发出 **TRIM** 或 **DISCARD** 命令。当 **丢弃** 启用时，系统会自动释放未使用的块，有助于在 **vSAN**.

## 启用或禁用磁盘丢弃

在创建或编辑 VM 磁盘时，您可以选择启用或禁用 **丢弃**。默认情况下， **丢弃** 已启用，并且强烈建议保持启用以获得最佳存储效率。当 **丢弃** 被禁用时，虚拟磁盘上已删除的文件不会立即释放相应的存储，可能导致存储资源被过度使用。

以下是当 **丢弃** 已启用时：

* 系统会定期识别并释放未使用的磁盘块。
* **vSAN** 存储保持优化，因为未使用的块会被回收。
* 磁盘空间使用情况更准确地反映虚拟机上存储的实际数据。

***

{% hint style="warning" %}
**仅因性能原因禁用丢弃**

禁用 **丢弃** 可能导致存储效率低下，并且只应出于特定的性能相关原因这样做。始终在 **VergeOS 支持** 禁用此功能之前咨询
{% endhint %}

## 为什么使用磁盘丢弃？

* **高效的存储管理**：当从虚拟机中删除文件时，未使用的块会立即被标记为可用，从而允许 **vSAN** 其重新将该空间用于其他数据。
* **提升磁盘性能**：丢弃操作有助于保持存储系统整洁且经过优化，减少管理碎片化或未使用块带来的开销。
* **空间回收**：尤其是在存储变动频繁的环境中（即频繁创建和删除文件）， **丢弃** 可确保空间持续被回收，避免存储膨胀。

## 何时禁用磁盘丢弃

在少数情况下，您可能需要禁用 **丢弃** 以提升性能，尤其是在某些工作负载下，发出 TRIM/DISCARD 命令的开销可能会导致延迟或变慢。在进行此更改之前，必须了解在存储效率方面的权衡，并咨询 VergeOS 支持以获得进一步指导。

***

通过保持 **丢弃** 启用，您可以确保 VergeOS 为虚拟机优化存储，保持高效率并尽量减少空间浪费。

***

{% 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/vm-disk-discard.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.
