Wednesday 3 June 2015

Citrix Xenserver VDI storage space not released

If you have used Citrix XenServer you will find very quickly that using the XenCenter interface will create more problems than can be avoided by learning the CLI interface.
When you create an snapshot and delete it the VDI remain in the disk reducing your available space and creating many other problems.

Fist find out your storage repositories, VM's and VDI's and match what disk you are actually using and what are not used. Label all you used VDI properly to reduce the change of a mistake. Add meaningful descriptions and names.

xe sr-list
xe vm-list
xe vdi-list

In my case I have only about 10 used VDI and about 80 show with xe vdi-list. So how to find what is used and what is not.

first I select any random vdi that has no name or description ( remember we added descriptions to all our used VDI)

xe sr-list
uuid ( RO)                : 07ecca1d-a964-0edb-4091-67b79026003b
          name-label ( RW): VM's
    name-description ( RW): NFS SR [192.168.101.2:/volume1/vm]
                host ( RO): xen0
                type ( RO): nfs
        content-type ( RO):



I know my SR and I used to find out my vdi

xe vdi-list sr-uuid=07ecca1d-a964-0edb-4091-67b79026003b

      uuid ( RO)                : e37278ff-0602-4f87-b60e-73d3dfeae484
          name-label ( RW): base copy
    name-description ( RW):
             sr-uuid ( RO): 07ecca1d-a964-0edb-4091-67b79026003b
        virtual-size ( RO): 250060210176
            sharable ( RO): false
           read-only ( RO): true

I pick a VDI that seem to not be label with name or description and I check if it is used. Nothing is returned.

  xe vbd-list vdi-uuid=e37278ff-0602-4f87-b60e-73d3dfeae484

One VDI that is been used show 

     xe vbd-list vdi-uuid=d4cc3000-c8f6-4048-b7f1-a5221b1c5538 | less
uuid ( RO)             : 110bf9bf-14c1-16fa-2f1c-6c4c75aac98c
          vm-uuid ( RO): 5884b6c2-e37f-af4f-0373-b029ec1ccca4
    vm-name-label ( RO): ArcGIS 10.1
         vdi-uuid ( RO): d4cc3000-c8f6-4048-b7f1-a5221b1c5538
            empty ( RO): false
           device ( RO): hda

Now just go ahead and remove it

     xe vdi-destroy uuid=e37278ff-0602-4f87-b60e-73d3dfeae484

If you encounter the error 
 This operation cannot be performed because the system does not manage this VDI
vdi: e37278ff-0602-4f87-b60e-73d3dfeae484 (base copy)

then you might be using NFS and you have to manually fo to yoru ount folder and delete the file

     ls -alh e37278ff-0602-4f87-b60e-73d3dfeae484.*
-rw-r--r-- 1 1024 users 46G Dec 31 18:56 e37278ff-0602-4f87-b60e-73d3dfeae484.vhd

then do the forget command

   xe vdi-forget uuid=e37278ff-0602-4f87-b60e-73d3dfeae484

Also you can make extra double sure that you are not deleting any vdi's used with

    xe vm-disk-list vm=testvm 





No comments:

Post a Comment