Trying to add a volume to postgres/vector database, crashing

muiterz
HOBBY

3 months ago

I have a pgvector template in raiway which has no volume. So everything I redeploy my data is gone I want to add a volume, but postgress crashes, after adding the volume.

The path is /var/lib/postgresql/data/pgdata but the error said:

  • initdb: error: directory "/var/lib/postgresql/data" exists but is not empty

  • initdb: detail: It contains a lost+found directory, perhaps due to it being a mount point.

  • initdb: hint: Using a mount point directly as the data directory is not recommended.

  • Create a subdirectory under the mount point.

    How to add a volume?

Solved

10 Replies

3 months ago

Can you try updating the volume's mounting point to /var/lib/postgresql instead of /var/lib/postgresql/data and let me know if that works ?


Status changed to Awaiting User Response Railway 3 months ago


itsrems

Can you try updating the volume's mounting point to /var/lib/postgresql instead of /var/lib/postgresql/data and let me know if that works ?

muiterz
HOBBY

3 months ago

I was thinking about that one, but I think that the volume will be very big?


Status changed to Awaiting Railway Response Railway 3 months ago


3 months ago

sorry I meant /var/lib/postgresql/data instead of /var/lib/postgresql/data/pgdata, which you said you were using


Status changed to Awaiting User Response Railway 3 months ago


3 months ago

psql would need access to the entire /var/lib/postgresql/data and not just the pgdatasubdirectory


itsrems

psql would need access to the entire /var/lib/postgresql/data and not just the pgdatasubdirectory

muiterz
HOBBY

3 months ago

the same error :(


Status changed to Awaiting Railway Response Railway 3 months ago


3 months ago

I don't see a volume on the pgvector service


Status changed to Awaiting User Response Railway 3 months ago


itsrems

I don't see a volume on the pgvector service

muiterz
HOBBY

3 months ago

I removed it after it crsahed


Status changed to Awaiting Railway Response Railway 3 months ago


muiterz
HOBBY

3 months ago

Its working now, I had to create a subfolder within the volume. Can be closed.


3 months ago

I had to create subfolder within the volume

As in manually ? In any case, glad to hear you're unlocked.

If you want to share some more details I'm sure it'll help us unblock the next person

If not, feel free to leave the thread as-is; our system will close it out.

Thanks,

Nico


Status changed to Awaiting User Response Railway 3 months ago


itsrems

I had to create subfolder within the volumeAs in manually ? In any case, glad to hear you're unlocked.If you want to share some more details I'm sure it'll help us unblock the next personIf not, feel free to leave the thread as-is; our system will close it out.Thanks,Nico

muiterz
HOBBY

3 months ago

Its easy. just create the volume with mount path for example /mnt/pgvolume

Set the variable PGDATA in postgres to /mnt/pgvolume/dbdata.

the subfolder is important. then redeploy all.


Status changed to Awaiting Railway Response Railway 3 months ago


Status changed to Solved itsrems 3 months ago


Trying to add a volume to postgres/vector database, crashing - Railway Help Station