0

I have a requirement in the Postgres 14 database, which is installed in a Windows server environment. I want to move the pg_wal directory files from my G drive, where I installed my Postgres 14 database, to my D drive. This is to reduce the read-write IO of the G drive and improve its performance.

I used the symbolic link (mklink) command as given below:

mklink /D "D:\pg_wal" "G:\Postgres-14\data\pg_wal"

Here G:\Postgres-14\data\pg_wal is where my pg_wal files are, and I want them to move to D:\pg_wal. This is working, and a shortcut folder is getting created, but still, pg_wal files are there in G:\Postgres-14\data\pg_wal location and I want all the pg_wal files to automatically move to D:\pg_wal directory without getting filled in the original location (G:\Postgres-14d\data\pg_wal).

In another words, G:\Postgres-14\data\pg_wal directory should be empty, and all the pg_wal files should be collected in D:\pg_wal whenever the log files are generated. Or move the entire pg_wal directory from G drive to D Drive. 

In this way, I can save space on the G drive and reduce the disk IO. Anyone, please help me get a solution or guide me if I'm doing anything wrong.

1 Answer 1

0

Looks like you are doing this the wrong way around. Try as follows:

  • shut down the PostgreSQL server (service)

  • move G:\Postgres-14\data\pg_wal D:\pg_wal
    
  • mklink /j G:\Postgres-14\data\pg_wal D:\pg_wal
    
  • start the PostgreSQL server

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your reply. I tried the same but I'm getting the message as below: C:\WINDOWS\system32>mklink /j G:\Postgres-14\data\pg_wal D:\pg_wal Cannot create a file when that file already exists.
Then you didn't move it. After you move G:\Postgres-14\data\pg_wal to D:\pg_wal it does no longer exist, and mklink should succeed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.