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).
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.
This doesn’t seem to work for me. Even though I added the following line to /nexus-data/etc/nexus.properties, the Nexus startup log shows it’s still using the default of 4096:
storage.diskCache.diskFreeSpaceLimit=1048
Nexus startup shows this:
2020-01-16 18:59:38,674+0000 INFO [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder - storage.diskCache.diskFreeSpaceLimit='4096'
system.properties file exists under more than one directory path and some of the files will have the parameter storage.diskCache.diskFreeSpaceLimit. I ran the linux command “find / -name system.properties” and got results for 4 paths (including the one mentioned by Rich Seddon). Only 2 files from the results had the parameter storage.diskCache.diskFreeSpaceLimit set at ~4GB. Please note that changing only 1 file, will not take effect on the system as in the Nexus UI showed by Michael Worthington. Therefore, you need to check and edit under all files named system.properties in your results. Only then will the change take effect.
My database locked at free space of approx. 400MB, I changed the storage.diskCache.diskFreeSpaceLimit setting to 300MB and it allowed me privileges again to delete files and clear my database.
My comment is very late, but I hope it will help someone. Myself and a colleague were struggling with the same problem the whole day and this thread was extremely useful. I just wanted to share what worked for me and hope my observation will be of help to someone else.