How to identify unused repositories in Satellite6?
Environment
Red Hat Satellite 6
Issue
Having enabled many repositories, some of them are contained in a Content View and some others directly enabled on Content Hosts in Default Content View / Library.
Doing some repositories cleanup, is there an easy way to identify what repositories are enabled, but not used?
Resolution
There is no simple way natively implemented in Satellite. But one can use the attached rake script to identify such unused repositories. It is advised to identify and remove unused Content Views first, following this solution. As that can reveal more further redundant repositories.
To identify unused repositories via the rake script: upload the script to Satellite, and execute:
# cat find_unused_root_repos.rake.txt | foreman-rake console | tail -n3 | head -n1 | python -m json.tool
[
{
"id": 37,
"name": "Red Hat Enterprise MRG Messaging 3 for RHEL 7 RPMs x86_64 7.1",
"url": "https://cdn.redhat.com/content/dist/rhel/server/7/7.1/x86_64/mrg-m/3/os"
},
{
"id": 79,
"name": "Advanced Virtualization CodeReady Builder for RHEL 8 IBM z Systems RPMs",
"url": "https://cdn.redhat.com/content/dist/layered/rhel8/s390x/advanced-virt-crb/os"
}
]
Those two repositories of given ID, name and feed URL are:
- enabled (either among Red Hat Repositories or inside a custom product), not necessarily synchronized
- not contained in any Content View
- not enabled by a Content Host
Be aware, the procedure works well for yum repositories only (that create content facets in Satellite). It can report "unused" docker or ISO repos despite they are in use.
Also be aware that disabling a synchronized repository will not remove downloaded packages immediately. That orphans removal is run via a weekly cron job /etc/cron.weekly/pulp-maintenance.To free some disk space under /var/lib/pulp after disabling the repositories, let run this script manually.
For more KB articles/solutions related to Red Hat Satellite 6.x Repository Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Repository Issues.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.