Clean up repository - only 20GB in repos 620GB used in /data!

We have our own company gitlab with 18 repos, the total usage shown for these is @20GB but the /data folder is nearly full at 620GB. I’ve looked for any help on google but nothing seems to work. Can anyone make any suggestions? Checking it seems one hashed folder is the culprit.
579G ./git-data/repositories/@hashed/ef/2d/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d.git
32K ./git-data/repositories/@hashed/ef/2d/
579G ./git-data/repositories/@hashed/ef/2d
579G ./git-data/repositories/@hashed/ef
And in there are loads of tmp_pack… files. Can I just delete these?

No, you shouldn’t really delete them like that. You should be using tools like git gc and git fsck.

From the web interface go to Admin → Overview → Projects then select a project and look at the Gitaly relative path: to ensure it matches @hashed/ef/2d like you have above. You will then need to use that path in a command similar to below:

/opt/gitlab/embedded/bin/git -C /var/opt/gitlab/git-data/repositories/@hashed/ef/2d/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d.git fsck

that is an example from mine but gives you an idea of what you need to run. You may also need to add after the fsck part ``–lost-found``` as an additional paramter, so:

/opt/gitlab/embedded/bin/git -C /var/opt/gitlab/git-data/repositories/@hashed/ef/2d/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d.git fsck --lost-found

You can use git gc also as mentioned, in a similar format to the above commands. Hope that helps.

As for the path, if you do not store under /var/opt/gitlab/git-data, and you use /data as you mentioned, then change that where appropriate.

Brilliant! Used gc and I now have 96% free on the /data partition.

Many thanks for your help.


1 Like