How to change the disk deletion interval to delete unused base disks on the VM storage

How to change the disk deletion interval to delete unused base disks on the VM storage

book

Article ID: CTX223133

calendar_today

Updated On:

Description

This article describes how to change the disk deletion interval to delete unused base disks on the VM storage through powershell commands


Instructions

Background :

DiskReaper_retryInterval - This defines how often each disk is checked, format is hh:mm:ss.ff, where the seconds (ss) and fractions (ff) are optional. Default is 6 hours.

DiskReaper_heartbeatInterval - This defines how often the check process runs to see if there is any pending work, in the same format, this will be constrained to be at most 1/5 of the retry interval so that there are at least 5 checks performed within the larger time space (it also cannot be 0). Default is 1 hour.

The basic behaviour (with the default time) is that a background process runs every hour and checks if there are any disks that haven't been checked for more than 6 hours. If there are then those disks are checked to see if it is safe to remove them (i.e. all VMs that were previously using the disk have now been updated to use a newer disk). If there are no VMs remaining for a given disk it will be deleted.

If we want the system to check more often we can set the heartbeat lower and if we want the disks to disappear faster after the last machine then reduce the retry.

Procedure :
  1. Open the powershell in administrator mode on the delivery controller
  2. Load Citrix snap-ins by running command - asnp citrix*
  3. Run Set-ProvServiceConfigurationData -Name DiskReaper_retryInterval -Value 10:0:0 | Out-Null to change to 10 hours
  4. Run Set-ProvServiceConfigurationData -Name DiskReaper_heartbeatinterval -Value 2:0:0 | Out-Null to change to 2 hours

Environment

The above mentioned sample code is provided to you as is with no representations, warranties or conditions of any kind. You may use, modify and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the sample code may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the sample code fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the sample code. In no event should the code be used to support ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SAMPLE CODE, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Although the copyright in the code belongs to Citrix, any distribution of the sample code should include only your own standard copyright attribution, and not that of Citrix. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the sample code.

Additional Information

http://discussions.citrix.com/topic/384175-mcs-deleting-basedisk-from-vm-storage/#entry1956002
http://discussions.citrix.com/topic/331755-problem-with-mcs-base-disk-deletion/