# Content-Pack-cleanup-for-SaaS-farms_692438713
### Context

Over time we see a lot of older CP versions pilling up on our SaaS farms. Each CP zip file is around 350-400MB and it's stored in the DB and on the disk. This can become a problem over time.

Also, the UCMDB server has some scheduled tasks to check the DB and the disk for newer CP files, calculate their checksums, and decide if the DB and disk storage need to be synched for newer CP zip files. This takes time and resources and has a performance impact. The UCMDB server does not do a CP zip file cleanup OOTB.

### A. Identify what we have before the cleanup

1. Get the list of used CPs from UCMDB server JMX using the method *viewSystemInformation*
2. Get the current list of CP versions from the DB. From JMX invoke *executeQuery* with the SQL query *select version from content\_packs*
3. Example of output for the query
4. *select version from content\_packs*  
	![](attachments/692438713/692438700.png)
5. Get the list of CPs from the disk. The path is /mnt/cms/var/vols/itom/cms/data-volume/ucmdb/server/content/content\_packs
6. Example of the available CPs on the disk  
	  
	![](attachments/692438713/692438701.png)

### B. Evaluate what we have

1. Check that the DB list is the same as the disk list. They should be the same
2. Compare the list from the DB and the one from *viewSystemInformation* to find the CP versions that are not used. In the DB list, CP versions are not present in *viewSystemInformation* . These are the CP versions to be deleted
	1. On the disk we may have directories with the same version as some of the CP zip files like CP-24.4.zip and directory 24.4.89. Both of them refer to CP 24.4 and can be deleted if they are not in the Support Matrix and if no customer is using that CP version.
3. Be careful about CP version and build number. We can have versions 24.4 build 116 and 24.4 build 117 and they are considered distinct CP versions. None, one or both can be used by a customer(s).
4. The current supported CP versions for the deployed UCMDB version need to be kept even if they are not used by any customer as any customer can upgrade to it and we support these versions. The CP Support Matrix is found at [https://docs.microfocus.com/doc/Universal\_Discovery\_Content\_Pack/24.4/CPSupportMatrix](https://docs.microfocus.com/doc/Universal_Discovery_Content_Pack/24.4/CPSupportMatrix)
	1. Example: for UCMDB 24.4 we support CP 23.4 but we need to keep this version even if no customer is using it.
5. Do a backup of content\_packs folder which can be removed after 1 week if there is no issue

### C. Cleanup

1. When the UCMDB servers are stopped we can delete from the DB and disk the CP versions from above that were not found in *viewSystemInformation*
	1. *set replicas to 0 for itom-ucmdb sts ( kubectl scale sts itom-ucmdb --replicas=0 -n cms )*
		2. *check both ucmdb pods are stopped*
2. Selective deletion of the unused/useless CP versions from the DB and disk. Once you identify a CP version(and build!) that is not used by any customer from *viewSystemInformation,* it can be deleted from the disk and from the DB one by one. This will take more time but it's safer and the server startup is not affected.
3. Keep supported versions as mentioned in step **B.4**
4. Query to delete from UCMDB DB a specific CP version from DB delete from CONTENT\_PACKS where version = '2022.11.99'
	1. Execute the query from UCMDB RDS, at this time, the UCMDB server is stopped, so can't delete it from JMX console
		2. use instead of 2022.11.99 any CP version that is no longer needed
5. Set replicas back to 2 for itom-ucmdb-sts ( kubectl scale sts itom-ucmdb --replicas=2 -n cms )

### D. Validate the results

1. Check the output of *viewSystemInformation*
2. List the available CP version in DB with the SQL query *select version from content\_packs*
3. List the files in */mnt/cms/var/vols/itom/cms/data-volume/ucmdb/server/content/content\_packs*
4. We should have the same count of CPs and the same CP versions in all 3 sources from above

In the past we had an unofficial cleanup procedure for the on-premise UCMDB

[https://community.microfocus.com/it\_ops\_mgt/ucmdb/f/discussions/140155/maintenance-tip-cleanup-of-the-old-content-packs](https://community.microfocus.com/it_ops_mgt/ucmdb/f/discussions/140155/maintenance-tip-cleanup-of-the-old-content-packs "https://community.microfocus.com/it_ops_mgt/ucmdb/f/discussions/140155/maintenance-tip-cleanup-of-the-old-content-packs")

**Related pages**

- Page:
	[ESM Cloud Farm Version Tracking](/display/ICSD/ESM+Cloud+Farm+Version+Tracking)
- Page:
	[How to get an Opentext Confluence account](/display/ICSD/How+to+get+an+Opentext+Confluence+account)
- Page:
	[ITOM APM AppPluse Cloud Farm Information](/display/ICSD/ITOM+APM+AppPluse+Cloud+Farm+Information)
- Page:
	[ITOM Cloud Service Ops Doc Management Process](/display/ICSD/ITOM+Cloud+Service+Ops+Doc+Management+Process)
- Page:
	[ITOM ESM Cloud Service Catalog](/display/ICSD/ITOM+ESM+Cloud+Service+Catalog)
- Page:
	[ITOM OpsB NOM Cloud Service Catalog](/display/ICSD/ITOM+OpsB+NOM+Cloud+Service+Catalog)
- Page:
	[OpsB and NOM Cloud Deployments Version Tracking](/display/ICSD/OpsB+and+NOM+Cloud+Deployments+Version+Tracking)
