Ubuntu corrupted

Hello,
I have a problem with a gitlab-ce 15.8.3 instance under Ubuntu.
The hard disk has become corrupted due to lack of space. I can’t access via linux commands on the bone anymore. How can I copy my entire Gitlab data without losing anything? (I can mount the disk to browse via another Linux).
I can’t make a backup, do nothing. I can’t reinstall the bone for fear of overwriting the data.
What can i do ?

So, assuming you can copy from the disk, you will need:

  • /etc/gitlab
  • /var/opt/gitlab

Since you had 15.8.3, you will need to install 15.8.3 on your new server. Then once installed, your next steps:

  • Replace /etc/gitlab/gitlab.rb and /etc/gitlab/gitlab-secrets.json on the new server (or just replace the entire /etc/gitlab directory with the one from the old server.)
  • Replace the entire /var/opt/gitlab directory with the one from the old server.

When copying from the old disk, it would be best that you preserve file permissions by using rsync, so:

rsync -av /path/to/old/disk/etc/gitlab/ /path/to/new/disk/etc/gitlab/
rsync -av /path/to/old/disk/var/opt/gitlab/ /path/to/new/disk/var/opt/gitlab/

assuming those commands completed successfully, in /etc/gitlab you should see gitlab.rb and gitlab-secrets.json as well as other files. In /var/opt/gitlab the structure should also look the same.

Then you need to do:

gitlab-ctl reconfigure

to make sure that everything is OK, and then see if it is started successfully:

gitlab-ctl status

Whether or not that will be successful or not is another story. You said it became corrupted due to lack of disk space, so that means it may not even be recoverable because…it’s corrupted.

Ideally you should have made backups of Gitlab which would have been stored under /var/opt/gitlab/backups, and then that backup along with gitlab.rb and gitlab-secrets.json would be all you need to restore your server using the Gitlab Backup/Restore docs. If you do have such backup, then see the docs here: Back up and restore GitLab | GitLab

1 Like

Thank you for your reply.
I will try,
However, the permissions of the Gitlab folders have been changed and don’t look like anything. I have gitlab-www as chown of gitlab-psql,…

How can I reset the permissions to make everything work? Do I base it on a fresh instance and copy the permissions by hand?

What do you mean by

don’t look like anything

Just that they look weird?

I think that gitlab-ctl is able to fix that in some cases, but that was already a part of @iwalker 's advise.

Mimicking the permissions from a fresh instance by hand might be your best option. If you don’t have a backup you can restore from, that is.

Just because they look weird?

Yes. All permissions are broken.
So, Gitlab doesn’t have permission (access denied) when I try to do a gitlab-ctl reconfigure.
I’ll try to set the permissions manually

I tried to follow your message and do everything. Unfortunately, when reconfiguring, gitlab does not reconfigure and resets to 0.

And no backups under /var/opt/gitlab/backups?

No, I didn’t have any backups

I suggest make a new server, create a new empty repo, and then use the commands from these posts using the directory structure from your old disk when mounted, to push it to the new server.

Once you get into one of the long random numbers.git directory, there will be a config file in there which is a text file. In here you will be able to find the name of what the repository was on your old server. An example from mine:

root@gitlab:/var/opt/gitlab/git-data/repositories/@hashed/45/23/4523540f1504cd17100c4835e85b7eefd49911580f8efff0599a8f283be6b9e3.git# ls
config  description  HEAD  hooks  info  language-stats.cache  objects  packed-refs  refs
root@gitlab:/var/opt/gitlab/git-data/repositories/@hashed/45/23/4523540f1504cd17100c4835e85b7eefd49911580f8efff0599a8f283be6b9e3.git# cat config 
[core]
	repositoryformatversion = 0
	filemode = true
	bare = true
[gitlab]
	fullpath = test/test

that fullpath option will be the group/project name where it existed. Then you can push it to the appropriate place using the commands from the posts I linked that have helped others in a similar situation who didn’t have backups.