Citrix

How to Reclaim Disk Space from Deleted XenServer Snapshots

  • CTX123400
  • Created On  Dec 15, 2009
  • Updated On  Jul 31, 2013
  • 44 found this helpful
  • Article
  • Topic : Storage

Summary

This article explains how to use the off-line coalesce tool after deleting snapshot or clone Virtual Machines to reclaim disk space.

Background

When snapshots or clones are deleted on LVM-based, Local EXT and NFS SRs, XenServer automatically reclaim disk space by liberating unused data, a process known as coalescing. XenServer coalesces the disk space while Virtual Machines remain running (online coalescing).

However, the XenServer 5.5 coalescing implementation has a known limitation. After deleting all the snapshots or clones of a Virtual Machine’s disks, some disk space might remain allocated. Although space consumed by deleted snapshots or clones in NFS and ext-based SRs is minimal, for iSCSI FC and local SRs, the amount of space consumed might be more significant.

To address this limitation, XenServer 5.5 Update 1 and later include an Off-line Coalesce tool. This tool can reclaim all disk space previously allocated to deleted snapshots or clones while the Virtual Machine is temporarily shut down or suspended (offline). The Off-line Coalesce tool and its use are described in the following sections.
Notes:

  • Running this script incurs some downtime for the Virtual Machine because of the suspend/resume operations performed.
  • Before running the tool, you must delete all snapshots and clones associated with the Virtual Machine, using either XenCenter or the XenServer CLI. If you do not, the script fails, the tool displays an error message, and it exits.
  • All Virtual Machine disks must be either on shared or local storage for a single host. Virtual Machines with disks in both types of storage cannot be coalesced.

Procedure – XenServer 5.5 Update 1 and later

Citrix recommends that you back up the Virtual Machine on which you will run the space reclamation tool. You can use the XenCenter export option for this purpose.
You must know your Virtual Machine’s UUID.

To Retrieve the UUID

  1. In XenCenter, enable hidden objects (View menu > Hidden Objects).
  2. In the Resource pane, select the Virtual Machine for which you want to obtain the UUID. The UUID appears in the General tab.

To Reclaim Disk Space

  1. Run the following command from the XenServer CLI:
    coalesce-leaf –u <uuid of VM>

    For example, if your Virtual Machine's UUID is 2a8d2815-c97e-245b-efe2-389ba456bd7p, you would run this command:
    coalesce-leaf –u 2a8d2815-c97e-245b-efe2-389ba456bd7p
  2. This command suspends the Virtual Machine (unless it is already powered down), initiates the reclamation process, and then resumes the Virtual Machine.

The amount of time required varies based on the amount of data written to the disk since the last snapshot. Smaller Virtual Machines (that is, 10 GB or less) take less than a minute.

Procedure – XenServer 5.6

Citrix recommends you to back up the Virtual Machine on which you will run the space reclamation tool. You can use the XenCenter export option for this purpose.
You must know your Virtual Machine and Host UUID.

To Retrieve the UUID

  1. In XenCenter, enable hidden objects (View menu > Hidden Objects).
  2. In the Resource pane, select the Virtual Machine for which you want to obtain the UUID. The UUID appears in the General tab.
  3. In the Resource pane, select the resource pool master host (the first host in the list). The UUID appears in the General tab. If you are not using a resource pool, select the host on which the Virtual Machine resides.

To Reclaim Disk Space

  1. Run the following command from the XenServer CLI:
    xe host-call-plugin host-uuid=<host-UUID> plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=<VM-UUID>

    For example, if your Virtual Machine's UUID is 9bad4022-2c2d-dee6-abf5-1b6195b1dad5 and your host UUID is b8722062-de95-4d95-9baa-a5fe343898ea, you would run this command:
    xe host-call-plugin host-uuid=b8722062-de95-4d95-9baa-a5fe343898ea plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=9bad4022-2c2d-dee6-abf5-1b6195b1dad5
  2. This command suspends the Virtual Machine (unless it is already powered down), initiates the reclamation process, and then resumes the Virtual Machine.

More Information

  • Citrix recommends that, before executing the off-line coalesce tool, you shutdown or suspend the Virtual Machine manually (using either XenCenter or the XenServer CLI). If you execute the coalesce tool on a Virtual Machine that is running, the tool automatically suspends the Virtual Machine, performs the required VDI coalesce operation(s), and resumes the Virtual Machine.
  • If the Virtual Disk Images (VDIs) to be coalesced are on shared storage, you must execute the off-line coalesce tool on the pool master.
  • If the VDIs to be coalesced are on local storage, you must execute the off-line coalesce tool on the server to which the local storage is attached.

Applicable Products

Share your comments or find out more about this topic

Citrix Forums

Was this helpful?

Thank you for your feedback!


| Terms of Use | Privacy | Governance