Gitlab OS Crashed


We are using Gitlab CE on Ubuntu OS. Yesterday, Our Ubuntu OS crashed automatically. We don’t have a backup of Gitlab repositories and Database or backup tar file.

Kindly help us to retrieve the code and repository. I have the option to take the directory and files through live Ubuntu OS. Please suggest if we can configure another Gitlab and restore the all configuration using directory and files.

Anish Raut

Please suggest if we can configure another Gitlab and restore the all configuration using directory and files.

Technically speaking, yes, this should work if you are able to access all the relevant files from the database, application, and configuration storage locations. Postgres is usually resilient to sudden shutdowns through use of its write-ahead-log, but it would greatly depend on the health and state of the disk. You will also need to be thorough and preserve permissions and all other associated filesystem metadata when you make your copy (tar has a helpful p option if you’ll be archiving it).

The best way would also be to install the exact same GitLab version on the new machine (or disk) and then replace its files from your copy, ensuring the permissions are still intact and use the same uid/gid.

If you are just after the repository data, you can selectively grab them from their configured storage location, and push them back onto a new installation with some manual effort.

P.s. When you say your OS crashed, I assume you mean the OS no longer boots. You indicate that the machine works, and that you can live-boot an OS into its memory and access its disk. Have you tried to recover the OS instead, if the disk is still healthy? If the disk has developed physical faults, then the copies cannot be trusted (reads could carry corrupted data silently).

1 Like

@anish.raut If you can copy files off of the disk using live Ubuntu OS, I suggest getting any/all of the following:

  • contents of /etc/gitlab/
  • contents of /var/opt/gitlab/backups

If you have a recent backup in /var/opt/gitlab/backups along with the gitlab.rb and gitlab-secrets.json files from /etc/gitlab, you can use the Backup Restore process.

To restore from backup, you’ll need to install the exact same version of GitLab CE that you were previously running. To find this out just by looking at the filesystem from a live CD boot, you can run cat /var/opt/gitlab/gitlab-rails/VERSION

If there’s not any recent backups in in /var/opt/gitlab/backups, copy the entirety of /var/opt/gitlab and somewhere safe (this is where your GitLab data is stored on disk).

Let us know how it goes!


My ubuntu OS booting but getting an error related to RAID. I don’t have GitLab backup on /var/opt/gitlab/backups location.

I copied the all contents from /var/opt/gitlab/ and /etc/gitlab on new machine with same permission but I am getting error code 502. Postgress SQL not showing UP.


Anish Rut