How to compact disk space for nexus blob repository

Image for post
Image for post

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.

Image for post
Image for post

Observe your disk space with

df -kh

You can always run your task manually.

Originally published at tentamen blog.

Written by

Founder of Tentamen, software testing agency.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store