과도한 디스크 할당 또는 스냅샷 생성으로 인해 발생하는 문제.
orphaned, 사용되지 않는 가상 디스크나 스냅샷 등이 디스크를 차지해서 발생한다.
증상
** mount된 disk rw -> ro
** df -h 0%
Size: 875.9 GB used of 875.9 GB total (13.6 TB allocated)
1개의 snapshot을 생성하면 아래 3가지 vdi가 만들어진다.
여기서 base copy가 문제가 됨
xcp는 아래와 같이 구성
과도한 snapshot이나 vm 이동이 일어나면 orphan vbd가 발생[1]
(snapshot이나 vm 지워도 디스크가 여전히 점유되는 현상: 주인 없는 스냅샷 파일이 남아 있는 상황)
snapshot과 orphaned disk를 삭제하는 것으로 해결한다.
#!/bin/bash
# script to list and optionally delete orphan VDIs
#
# Usage:
# orphan_vdi.bash [-x] <-s SR_UUID>
# You can obtain your storage repo UUID via:
# xe sr-list
# Logic:
# We assume that a VDI is orphan if no VM claims it.
#
# First print all VDIs managed by us:
# xe vdi-list
# Then, for each VDI, check if a VBD corresponds to it.
# xe vbd-list vdi-uuid=$vdi
#
# Glossary:
# VDI: Virtual Disk Image, a piece of storage repository given to a VM. Can be in many formats.
# Think of it as a virtual hard disk, stored as a flat file.
# VBD: Virtual Block Device, describes a VDI so that it can be plugged to a VM.
# Think of it as a mapping or connector between a VDI and a VM.
# In XenCenter, see Storage tab within a VM.
function vdis_processor () {
if [ $# -ne 2 ] ; then
echo "bad number of args to vdis_processor"
return
fi
sr_uuid=$1
do_delete=$2
echo "vdis_processor: sr_uuid: $sr_uuid, do_delete: $do_delete"
vdis=`xe vdi-list sr-uuid=$sr_uuid params=uuid managed=true --minimal`
for vdi in `echo $vdis | tr ',' ' '` ; do
vm_name=`xe vbd-list vdi-uuid=$vdi params=vm-name-label | grep vm | awk '{ print $NF }'`
if [ $do_delete == 1 ] ; then
if [ "$vm_name" == "" ] ; then
echo -e "DO_DEL\t$vdi"
xe vdi-destroy uuid=$vdi
else
echo -e "OK\t$vdi\t$vm_name"
fi
else
if [ "$vm_name" == "" ] ; then
echo -e "DEL\t$vdi"
else
echo -e "OK\t$vdi\t$vm_name"
fi
fi
done
}
do_delete=0
while getopts ":xs:" opt; do
case $opt in
x)
do_delete=1
;;
s)
sr_uuid=$OPTARG
;;
esac
done
echo "args: sr_uuid: $sr_uuid, do_delete: $do_delete"
vdis_processor $sr_uuid $do_delete
Active VDI – As the name suggest it is the VDI which holds the current writes.
This VDI is set to read-write to hold the current writes.
Base Copy – The deflated size of your changes before snapshot. This VDI is set to read-only.
If the active VDI needs data to be read prior snapshot it will read from the base copy.
Snapshot Metadata – This holds the snapshot metadata such as the time the snapshot was taken,
the parent, etc. Default size is 8MB for LVM based SRs and few KBs in File based SRs.
Reboot
The shortest means to resolve this is to reboot the XenServer which owns the VDI
Remove the Virtual Block Disk (VBD)
Another way is to find the link between your virtual disk and DOM0 (the control domain) from your stand-alone XenServer (or primary server if you have a pool).
https://support.citrix.com/article/CTX207574
Basically it boils down to disk operations on/from a VM failing.
Operations such as move, copy, snapshot, export, etc.
The control domain (XenServer/dom0) protects the source VDI until virtual disk-based operations complete.
https://support.citrix.com/article/CTX207574
↩︎