How to store and work from a Postgresql database on an external hard drive?
I suggest you to create a new cluster in your external drive. You can use initdb
to create a new PostgreSQL database cluster.
Here is a sample command;
C:\Program Files\PostgreSQL\13\bin\initdb --pgdata=&quot;F:\MyProject\pgdata\13\main&quot;

After that you even can register your new cluster as a new postgresql server service by using pg_ctl like the one below;
C:\Program Files\PostgreSQL\13\bin\pg_ctl register --pgdata=&quot;F:\MyProject\pgdata\13\main&quot;