Gitlab takes up all the free disk space

Gitlab is a great product. Gitlab makes it possible to easily, quickly and for free deploy your own GIT and work with it in the same way as with any other git server. You do not need particularly strong administrative knowledge to deploy it, especially using Docker.

I deployed it more than 3 years ago in my company, and at that time I was not familiar with Docker and brought up gitlab the old fashioned way, relying on the manuals on the official website, without particularly going into details.

3 years passed and gitlab grew and began to take up indecent amount of space - more than 50 GB on VPS, on which the entire disk capacity is 80 GB. At one point, the place simply ended. Running the good old NCDU program, I found out that prometheus logs occupy 40GB! I did not use it directly in my work at all and I decided to delete the logs and turn off the prometheus. This is done quite simply (https://docs.gitlab.com/ee/administration/monitoring/prometheus/)

  1. Open the file /etc/gitlab/gitlab.rb
  2. Add prometheus_monitoring ['enable'] = false
  3. Save file

After that, it is necessary to rebuild the gitlab configs. The first time I did not do this and could not understand what was the matter. To rebuild configs you need to enter the command

sudo gitlab-ctl reconfigure

There was a problem with the removal of the accumulated logs - there were too many of them and everything was broken into by a large number of small files. IO simply could not stand it and the server "paused" when I started rm. The instructions on Habr helped me - https://habr.com/ru/post/157613/. After reading this article I used this command (!!!USE IT CAREFULLY!!!)

perl -e 'chdir "/var/opt/gitlab/prometheus/data_back" or die; opendir D, "."; while ($n = readdir D) { unlink $n }'