Xenserver删除VM存储无法释放

(1)执行命令:

1
xe vdi-list,

如果记得之前分配给VM磁盘的name-lable,可以通过name-lable查找,如果不记得了,找到与你之前分配给VM的存储大小接近的磁盘,如下:

(2)找到以后输入命令

1
lvremove /dev/VG_XenStorage-<sr-uuid>/VHD-<vdi-uuid>

有可能会提示:  lvremove /dev/VG_XenStorage-6f5e0962-afcd-8222-18fe-eb02292d327b/VHD-bd9c17f5-4571-4f4a-92de-ce64049f0c1a: Command not permitted while global/metadata_read_only is set.

解决办法:
[root@xen dev]# lvremove /dev/VG_XenStorage-6f5e0962-afcd-8222-18fe-eb02292d327b/VHD-bd9c17f5-4571-4f4a-92de-ce64049f0c1a --config global{metadata_read_only=0}

结果:
Logical volume "VHD-bd9c17f5-4571-4f4a-92de-ce64049f0c1a" successfully removed

(3)重启xenserver:

1
reboot