How to compact disk space for nexus blob repository

Karlo Smid
2 min readAug 11, 2018

TL;DR

This post is about how to do periodic cleanup of Nexus blob repository.

What?

Nexus is web application that manages repositories of artifacts. Artifact could be .jar or .zip archive, in my context this is .zip archive. Usual context is:

Create artifact

Upload

Get that artifact.

In Nexus configuration, I chose blog type repository storage.

The problem?

Disk space of host where Nexus was installed filled up very quickly. In our context, very quickly was one week for upload rate of one repo per day. What troubled me was the fact that we kept only two versions of artifact, current and previous one. However, space depleted at same rate.

The context

Working with great database administrators, I learned that every database is actually a number of files. Files work with data chunks, which means that after record delete file becomes fragmented and there are parts of file that can not be used anymore for data storage. The notorious fragmentation problem! File needs to be defragmented.

Connecting that with my problem, I searched Nexus documentation for space issues and found compact feature!

The solution

Log in to nexus as admin, and select System/tasks.

Create compact blob for your repository, schedule job and you are done.

Observe your disk space with

df -kh

You can always run your task manually.

Originally published at tentamen blog.

--

--