9 days ago
Body:
I'd like to mount an existing, unmounted volume to a Postgres service so I can export data from it. To be clear up front: I'm not asking for data recovery. The volume was never overwritten — it's simply detached.
I deployed a fresh n8n instance using the n8n-1 template, which created new PostgreSQL and n8n services. My original Postgres volume was left unmounted in the process, and it still holds the workflows I need.
Project details
Project ID: 9aac23d5-1b58-4c2d-a041-422c931810c3
Environment: production (8551f43e-3560-47d8-a88e-c0f8f31cc5d7)
Original volume (unmounted, data intact as far as I know)
Volume ID: 2837e9ba-664c-486d-99ea-c06b80edfd19
Name: postgres-volume
Size: 500MB
Status: Unmounted — nothing has written to it since detachment
Current volume (new, in use)
Volume ID: 3a93a971-fe48-4a2a-9771-3ae344149aa1
Name: postgres-volume-ZAtE
Size: 5000MB
Status: Mounted on the postgres service
Current n8n service
Service ID: 7bfa1931-1824-40b4-b878-1422b88574ec
Name: n8n-cMC4
Status: Running, connected to the new Postgres
What I'm asking
Can I attach volume 2837e9ba-664c-486d-99ea-c06b80edfd19 to a new Postgres service (mounted at /var/lib/postgresql/data) so I can connect to it and run a pg_dump? I'd then import that dump into my current database and detach the old volume again.
If that's possible through the dashboard, I'm happy to do it myself — I just want to confirm the correct procedure before touching anything, since I understand a Postgres service initialising against an existing data directory can overwrite it. If it needs to be actioned on your side, please let me know.
I'm not asking anyone to inspect or extract the volume's contents — only to attach it so I can read from it through a running service.
Pinned Solution
9 days ago
Try this:
- Click into your database service and go to the console tab
- Run this command:
sed -i 's/host all all all scram-sha-256/host all all ::\/0 trust/' /var/lib/postgresql/data/pgdata/pg_hba.conf(This will bypass user authentication) - Redeploy your database
- Console again, and run the command
psql - Run
ALTER USER postgres with password '<PASSWORD>';where<PASSWORD>is the value of the variablePGPASSWORDin your Railway dashboard - Type
exit - Run
sed -i 's/host all all ::\/0 trust/host all all all scram-sha-256/' /var/lib/postgresql/data/pgdata/pg_hba.conf(This will re-enable user authentication) - Redeploy your database
7 Replies
9 days ago
Having looked into this, the issue appears to be in your application code or configuration rather than the Railway platform itself, which puts it outside what Railway support can resolve directly.
This is exactly the kind of problem the Railway community is good at, so we'd like to open your thread as a community bounty. Railway pays a bounty to the community member who solves it, and threads like this usually get picked up quickly.
Opening it makes this entire thread public, including everything already posted. Nothing becomes public until you decide. Use the buttons below.
- Open to the community - Before you click, take a moment to edit or remove anything you'd rather not share. The thread becomes publicly visible right away.
- Keep it private and close the thread - Nothing becomes public. The thread closes, since this isn't something Railway support can take further.
Status changed to Awaiting User Response Railway • 9 days ago
9 days ago
This thread has been opened as a public bounty so the community can help solve it. The thread and any further activity are now visible to everyone.
Status changed to Open Railway • 9 days ago
9 days ago
You can simply drag the unmounted volume over the existing Postgres service to swap volumes.
9 days ago
Keep in mind you may need to retain the old N8N encryption keys used in the old volume if you wish to access such data.
9 days ago
I mounted the old postgres-volume (ID: 2837e9ba-664c-486d-99ea-c06b80edfd19) to the postgres service as you advised. However, the old volume's PostgreSQL password does not match the current Postgres service's configured POSTGRES_PASSWORD.
Result: n8n-cMC4 (ID: 7bfa1931-1824-40b4-b878-1422b88574ec) is crashing with repeated "password authentication failed for user postgres" errors.
Current setup:
Old Postgres volume mounted at /var/lib/postgresql/data on postgres service (ID: 798a460b-e45c-4ec3-929b-1dcdb1d0ddfa)
New n8n service connected with correct credentials, but cannot authenticate
Please help with one of these:
What is the password for the old Postgres database on this volume?
Or, can you reset the old volume's postgres password to match the current Postgres service's configured POSTGRES_PASSWORD?
The workflows are there—this is just a credentials mismatch preventing n8n from reading them.
9 days ago
Try this:
- Click into your database service and go to the console tab
- Run this command:
sed -i 's/host all all all scram-sha-256/host all all ::\/0 trust/' /var/lib/postgresql/data/pgdata/pg_hba.conf(This will bypass user authentication) - Redeploy your database
- Console again, and run the command
psql - Run
ALTER USER postgres with password '<PASSWORD>';where<PASSWORD>is the value of the variablePGPASSWORDin your Railway dashboard - Type
exit - Run
sed -i 's/host all all ::\/0 trust/host all all all scram-sha-256/' /var/lib/postgresql/data/pgdata/pg_hba.conf(This will re-enable user authentication) - Redeploy your database
mannylabs24
I mounted the old postgres-volume (ID: 2837e9ba-664c-486d-99ea-c06b80edfd19) to the postgres service as you advised. However, the old volume's PostgreSQL password does not match the current Postgres service's configured POSTGRES_PASSWORD. Result: n8n-cMC4 (ID: 7bfa1931-1824-40b4-b878-1422b88574ec) is crashing with repeated "password authentication failed for user postgres" errors. Current setup: Old Postgres volume mounted at /var/lib/postgresql/data on postgres service (ID: 798a460b-e45c-4ec3-929b-1dcdb1d0ddfa) New n8n service connected with correct credentials, but cannot authenticate Please help with one of these: What is the password for the old Postgres database on this volume? Or, can you reset the old volume's postgres password to match the current Postgres service's configured POSTGRES_PASSWORD? The workflows are there—this is just a credentials mismatch preventing n8n from reading them.
9 days ago
POSTGRES_PASSWORD only applies on first init of an empty volume. Since you mounted an existing one, it's ignored, real password is whatever's already in that data dir.
Fix: open the Postgres Console tab, run psql -U postgres (local socket, no password needed), then ALTER USER postgres WITH PASSWORD 'newpass';. Update POSTGRES_PASSWORD var to match, point n8n at it, redeploy. Data's untouched.
0x5b62656e5d
Try this: 1. Click into your database service and go to the console tab 2. Run this command: `sed -i 's/host all all all scram-sha-256/host all all ::\/0 trust/' /var/lib/postgresql/data/pgdata/pg_hba.conf` (This will bypass user authentication) 3. Redeploy your database 4. Console again, and run the command `psql` 5. Run `ALTER USER postgres with password '<PASSWORD>';` where `<PASSWORD>` is the value of the variable `PGPASSWORD` in your Railway dashboard 6. Type `exit` 7. Run `sed -i 's/host all all ::\/0 trust/host all all all scram-sha-256/' /var/lib/postgresql/data/pgdata/pg_hba.conf` (This will re-enable user authentication) 8. Redeploy your database
9 days ago
Thanks a lot this worked!
Status changed to Solved 0x5b62656e5d • 9 days ago
