Switching to Read-Only Mode BEFORE Running Out of Storage?


#1

Over the past month, I’ve had to restore my Nexus Repo instance from backups because when it ran out of space, the databases got corrupted somehow. I know that Nexus goes into read-only mode when the server is out of storage, but is it possible to fire off a warning email and also go into read-only mode at a user-defined percentage storage remaining… (e.g. when it’s nearing 5% storage remaining or even 5GB remaining, switch to read-only mode for component database and blobstore whilst also send an email to a user-defined email).

Thanks for any info y’all can provide!


#2

I answered this on a support ticket for you, but I’ll post it again here so others can benefit.

You can configure this by adding a line like this to sonatype-work/nexus3/etc/nexus.properties:

storage.diskCache.diskFreeSpaceLimit=8192

That will set the limit to 8G.

In version 3.14.0 we increased the default from 256Mb to 4Gb, so if you’re on an older version you can just upgrade. That would be a good idea in any case.

Also note that it is a very good idea to put blob storage on a different disk than the rest of the work directory. That will prevent someone uploading a very large file and causing database corruption.

Rich