弹霄博科

小谈谈一亩三分地



删除 Xenserver 残留的磁盘(Control domain on host)


发布日期: 2018/03/13
更新日期: 2020/04/27
作者: 小谈谈
分类: 虚拟化
标签: xensystem, disk
阅读时间: 2 分钟
字数: 270 字


昨天遇到一个坑,我在使用 XenCenter 为 XenServer 导入 Custom Templates 时因为网络故障导致任务终止,在 Local Storage Repositories 中存在一个残留的磁盘文件无法删除。 查询磁盘状态“This operation cannot be performed because this VDI is in use by some other operation.”,磁盘的“Virtual Machine”显示“Control domain on host”。

我们通过如下的方法,干掉这个“尸体”磁盘。

1.SSH 到 XenServer 或 LocalConsole 进入 xsconsole 模式

2.确定“尸体”磁盘的 VDI

xe vdi-list name-label=NAME>

返回

uuid (RO): fe571423-50e7-4df6-9406-3d7bc35ecebd name-label (RW): NAME> name-description (RW): System Disk sr-uuid (RO): 044e54b9-6018-b63b-4ae0-4320e083858e virtual-size (RO): 32212254720 sharable (RO): false read-only (RO): false

其中 fe571423-50e7-4df6-9406-3d7bc35ecebd 就是该磁盘的 UUID

3.根据 VDI 确定 VBD

xe vbd-list vdi-uuid=UUID>

返回

uuid (RO): 7d01305c-3ffd-5fe2-0811-4f8c79d30a72 vm-uuid (RO): 1462452b-4737-c68f-d1d3-09f25922d728 vm-name-label ( RO): vps924 vdi-uuid (RO): fe571423-50e7-4df6-9406-3d7bc35ecebd empty (RO): false device (RO): hda

其中 7d01305c-3ffd-5fe2-0811-4f8c79d30a72 就是 VBD 的 UUID

4.断开 VBD 到主机的连接

xe vbd-unplug uuid=UUID>

5.删除 VBD

xe vbd-destroy uuid=

6.在 XenCenter 中删除“尸体”磁盘。