How to backup crashed gitlab server


I had a GitLab server. It just crashed in these days. I am trying to restore files but I do not have any backup. I have the system files of my server as you can see below.


I copied these files into another computer if I create a new GitLab server on that computer. How can I get the older repositories from the system files?

There might be a lot of work needed to make it work. Need more info, environment info, gitlab version / install method etc

Hopefully you didn’t copy from the old server to a Windows system, else all the permissions will be screwed. So hoping you copied from the crashed Linux server to a new Linux server or another Linux machine.

You will definitely need:


at a minimum. It would also be ideal to know the version you had installed. It’s not a good idea to copy things like the rest of the operating system, unless it’s completely the same as the one that was installed on the old server. Also, if the system isn’t working because it crashed, the you only want to be copying what you need.

In theory, the steps you should need are:

  1. Install same Gitlab version on the new system that was installed on the old server.
  2. Copy the directories I mentioned above to the new server.
  3. Run gitlab-ctl reconfigure which should read everything from /etc/gitlab, and use the data in /var/opt/gitlab to get your system reconfigure and running.

After this, you should be able to use:

gitlab-ctl status

to make sure it’s running. Also you may need to do:

systemctl enable gitlab-runsvdir
systemctl restart gitlab-runsvdir

some other issues that might occur if that doesn’t work, is because the gitlab users in /etc/passwd have different UID/GID on the new server than the old server. There is a post on this forum that mentions about using rsync and copying data similar to what you would have to do in this post to get the system working. Server migration to newer OS

You may wish to make your gitlab users have the same uid/gid as the original server before running the reconfigure to get the system up and running. Especially if not using rsync in a certain way to get around it.

1 Like