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).