I’ve ran into a problem with the postgresql charm. After a reboot, postgresql wont start and seem to be missing critical files.
This is what I see:
systemctl status postgresql
...
Error: /var/lib/postgresql/12/main is not accessible or does not exist
In the directory:
ls -l /var/lib/postgresql/12/main
lrwxrwxrwx 1 root root 19 Sep 23 13:20 /var/lib/postgresql/12/main -> /srv/pgdata/12/main
Looking at the juju storage for postgresql charm:
juju status --storage
...
Storage Unit Storage ID Type Pool Mountpoint Size Status Message
nextcloud/0 datadir/0 filesystem data /var/nextcloud/data 1000GiB attaching attaching filesystem 0 to machine 0: container "juju-b8aeb2-0" already has a device "filesystem-0"
postgresql/0 pgdata/1 filesystem rootfs /srv/pgdata 2.9TiB attached
Somehow, the database files has gone away.
There seem to be some other directory names “main” for postgresql, is this some kind of backup ?
ls -la /var/lib/postgresql/12/
total 4
drwxr-xr-x 3 postgres postgres 4 Sep 23 13:20 .
drwxr-xr-x 7 postgres postgres 8 Mar 16 09:29 ..
lrwxrwxrwx 1 root root 19 Sep 23 13:20 main -> /srv/pgdata/12/main
drwx------ 19 postgres postgres 21 Sep 23 13:20 main-1663939245
Any help here appreciated to help me recover the database.