skip to content

Why does a cleanup run in Nexus Repository not free disk space at once, and what finally reclaims it?

level: middleimportance: must knowfreq 52%

answer

  1. two stages, not one
  2. a marker, not a removal
  3. per blob store task
  4. Blobs Older Than grace window

basics

~20 s

Nexus Repository cleanup only soft-deletes: it marks components for removal, hides them and leaves their blobs on disk, still recoverable. Disk space returns only when the Admin - Compact blob store task hard-deletes soft-deleted blobs, scheduled per blob store.

solid answer

~40 s

Nexus Repository splits deletion in two. The cleanup task soft-deletes matching components by marking their metadata, so they vanish from the UI and clients but their blobs stay in the blob store and can still be recovered. The **Admin - Compact blob store** task is the hard delete that frees the disk; it runs per blob store, so each blob store needs its own scheduled task, ideally off-peak. Its **Blobs Older Than** setting (default 0 days) can keep soft-deleted blobs as a recovery window. For Docker there is a middle step: cleanup removes tags, and *Docker - Delete unused manifests and images* soft-deletes the orphaned manifests and layers before compaction. Layers still shared with tagged images are never freed.

go deeper

for a junior

Remember the two words: cleanup soft-deletes, compaction hard-deletes. Deleted from view is not deleted from disk.

for a middle

Explain why the split exists, that compaction is scheduled per blob store, what Blobs Older Than does, and the extra Docker step that turns removed tags into orphaned manifests and layers.

for a senior

Diagnose a disk that will not shrink: task history, a missing compact task for one blob store, a deliberate grace window, the Docker manifest step, and layers still shared with tagged images.

for a principal

Decide how long soft-deleted content should stay recoverable, weighing the cost of held storage against the cost of an unrecoverable mistake, and make that window an explicit, written setting.

## Deletion happens in two stages Most repository managers and registries separate **deciding** that something is gone from **reclaiming** the disk it used. The first stage is cheap, fast and often reversible; the second is expensive, slow and final. Engineers who expect a cleanup run to shrink the disk at once are usually looking at the end of stage one. ## Soft delete in Nexus Repository When a cleanup policy runs in Nexus Repository, the task *Admin - Cleanup repositories using their associated policies* does not remove files. It **soft-deletes** the matching components by updating their metadata with a deletion marker. From then on: - the component no longer appears in the user interface or to clients; - its blobs still sit in the **blob store** and still consume space; - an administrator can still recover it if it was removed by mistake. A companion task per format, *Admin - Cleanup unused asset blobs*, soft-deletes orphaned assets left behind once a component is removed. Marking instead of removing keeps the cleanup task fast and leaves room to recover a mistake, which is why the design splits the work this way. ## Compaction is the hard delete Space comes back only when the **Admin - Compact blob store** task runs. It permanently removes soft-deleted blobs from storage. Three details matter in practice: 1. **One task per blob store.** Compaction works on a blob store, not on a repository, so every blob store that needs cleanup needs its own scheduled compact task. 2. **Run it off-peak.** Compaction is the heavy part of the cycle; the documentation recommends quiet hours. 3. **A grace window is optional.** The task's **Blobs Older Than** setting keeps soft-deleted blobs for a number of days before hard-deleting them. The default is 0 days, which removes them on the next run; a higher value turns the soft-delete stage into a recovery window at the cost of holding the space longer. ## Blob stores, groups and quotas A **blob store** is the storage behind repositories: a file-system folder, network storage or object storage. Many repositories can share one blob store, and a repository can instead use a **blob store group**, whose **fill policy** decides which member blob store each new blob is written to. That sharing is why compaction is scheduled per blob store, and why a repository's own size and its blob store's disk usage are different numbers. A Nexus **soft quota** watches a blob store and raises an alert when a metric passes its limit. The store is reported unhealthy, but writes are still allowed with a logged warning. It warns you about growth; it does not stop it, and it does not trigger compaction. ## Docker repositories need one more step Container content is split into tags, manifests and layers, and Nexus cleans them in layers too: - a cleanup policy soft-deletes old **tags**, not layers or manifests; - the task *Docker - Delete unused manifests and images* soft-deletes manifests and layers no tag references any more; - only then does compaction free the space. Layers shared with images that are still tagged stay, because something still references them. Deleting one image therefore frees only what was unique to it. ## The same pattern elsewhere | Product | What a delete does first | What frees the disk | |---|---|---| | Nexus Repository | marks components soft-deleted | the compact blob store task | | Artifactory, Trash Can enabled | moves items deleted from local repositories into the Trash Can, restorable for its retention period | emptying the Trash Can, or the end of that retention period | | Harbor | removes the artifact; space is not freed automatically | a garbage collection run | | Open-source Distribution registry | removes references so the content can no longer be read | the registry's garbage-collect command | The vocabulary differs, but the reasoning carries: a delete is first a change of **visibility and references**, and the bytes leave only when a separate process confirms nothing needs them. ## What to check when the disk does not shrink - Has the cleanup task actually run, and did its preview show matches? - Is a compact task scheduled for **this** blob store, and has it run since? - Is Blobs Older Than holding the soft-deleted blobs on purpose? - For Docker, has the unused-manifests task run between cleanup and compaction? - Are the remaining layers shared with images that are still tagged?

  • Why might you set the compact task's Blobs Older Than value above its default?
    The default of 0 days hard-deletes soft-deleted blobs on the next compaction. Setting, say, 7 days keeps them for a week, so a component removed by an over-broad policy can still be recovered after someone notices. The cost is that space returns a week later, which matters when a blob store is already close to full.
  • After a Nexus cleanup policy removes old Docker tags and compaction runs, why has the blob store barely shrunk?
    A Docker cleanup policy soft-deletes tags, not the manifests and layers they point to. Until the Docker - Delete unused manifests and images task soft-deletes the now-untagged manifests and orphaned layers, compaction has little to remove. Even then, layers shared with images that are still tagged stay, because something still references them.
  • What does a Nexus Repository soft quota do when a blob store passes its limit?
    It raises an alert and reports the blob store as unhealthy, but it still allows writes with a logged warning. It is a monitoring signal, not an enforcement point: it does not reject uploads and does not start cleanup or compaction. Harbor's project quotas behave differently and cannot be exceeded.

It works like a desktop recycle bin: deleting a file moves it to the bin, where it is hidden but still restorable and still taking space, and the disk is freed only when the bin is emptied. Compaction is emptying the bin.

  • Deleting a component in Nexus Repository frees its disk space immediately.
  • The compact blob store task decides which components are old enough to delete.
  • One compact task covers every blob store on the instance.
  • A Nexus soft quota rejects uploads once the blob store passes its limit.
  • Soft-deleted components are gone for good and can never be recovered.