0

So we had a problem with our Hard disk which contained the data folder for postgres after fixing the problem moved data folder into a new hard disk and change the docker_compose.yml we have following contents in the docker compose file

db:
  image: postgres:9.4
  volumes:
    - /mnt/hdd4/postgresql/data:/var/lib/postgresql/data
    - ./tmp:/tmp/docker
  ports:
    - "5432"

now when I we try to start the db container I'm getting following error

db_1                | 
db_1                | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1                | 
db_1                | LOG:  database system was interrupted; last known up at 2020-04-07 18:03:04 UTC
db_1                | LOG:  invalid primary checkpoint record
db_1                | LOG:  invalid secondary checkpoint record
db_1                | PANIC:  could not locate a valid checkpoint record
db_1                | LOG:  startup process (PID 28) was terminated by signal 6: Aborted
db_1                | LOG:  aborting startup due to startup process failure
app_db_1 exited with code 1

can someone help? please let me know if you need more information we really need the data its about 243 GB in size and very important.

Asnad Atta
  • 3,855
  • 1
  • 32
  • 49
  • This looks more like a postgresql problem. Have your tried using an empty volume and restoring the database from a backup ? – invad0r Apr 17 '20 at 08:59
  • I do not have backup or dump that's the problem – Asnad Atta Apr 17 '20 at 09:50
  • could you try to reset the write-head log on a copy of your data ? see: https://stackoverflow.com/a/8812934/2087704 and https://orawiki.org/2018/11/06/postgres-panic-could-not-locate-a-valid-checkpoint-record/ – invad0r Apr 17 '20 at 11:11
  • thanks @invad0r I'm getting this pg_resetxlog: cannot be executed by "root" You must run pg_resetxlog as the PostgreSQL superuser and when I try with su postgres it returns pg_resetxlog: command not found – Asnad Atta Apr 17 '20 at 12:03
  • try running container with that user and adding a volume e.g. `docker run -ti --user postgres -v /mnt/hdd4/postgresql/data:/postgres/data postgres:9.4 ..` – invad0r Apr 17 '20 at 12:08

0 Answers0