Preface
Sometimes after BellaDati installation with "built in" database we need more space for database data.The next procedure describes in several
steps HOW to MOVE data to NEW DRIVE , where disk with bigger capacity is ready.
(The text below is based on https://wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_on_Windows)
Step 1: Select the new drive and new directory for database cluster data
Example: current location is C:\Program Files\BellaDati\pgsql\data
Drive D:\ is more suitable for our future BellaDati exploitation (disk is much more bigger ...)
We have decided to move the whole directory data to new location D:\pgsql\data
Step 2: Stopping running BellaDati application complex
Use BellaDati icon stop server
The action will stop BellaDati complex i.e. both application server GlassFish with deployed application BellaDati
and running PostgreSQL database cluster
Check Windows task manager : Start->Settings->Control Panel->Administrative Tools->Services
It shows both BellaDati and BellaDati-pgsql are stopped now:
Step 3: Change Registry Values
Start the Windows Registry Editor (regedit.exe) and navigate to: "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pgsql-some version".
Double click on "ImagePath" and change the directory after the "–D" option to your new location.
If the path to your new location contains spaces, you should then enclose it with quotes.
In our example, former path C:\Program Files\BellaDati\pgsql\data is changed into new path D:\pgsql\data
Look for image path after editing:
pg_ctl.exe start/stop/reload postgresql database cluster . The command location is not changed, all settings in BellaDati complex stay. We can see, the port
where postgresql is listening 5439, we can see new location for cluster data D:\pgsql\data.
Step 4: Moving current PGDATA directory to the newly specified directory.
This is about copy files from directory C:\Program Files\BellaDati\pgsql\data directory D:\pgsql\data.
Please note that you should do this as Administrator on server machines.
Step 5: Check / modify user permissions
See permissions to old C:\ ...\data files (who can do what)
Check the same in the new directory and if needed, modify to ensure the username under which your PostgreSQL instance runs has permissions to do so in the new directory, otherwise it will not start
Step 6: Close and re-open the Windows Services Management window.
This refreshes the path you just changed in the registry without the need to restart your system.
After closing and re-opening the Services Management window, you should check the "path to executable" information of the PostgreSQL Database service. The path after "–D" option should be pointing to your new directory now.
Now that the PGDATA directory has been re-located and the service startup parameter in the registry has been modified, you can go ahead and start the service
Step 7: Start application
We use icon BellaDati Start server
Checking Windows task manager : Start->Settings->Control Panel->Administrative Tools->Services
shows both BellaDati and BellaDati-pgsql are running now:
Step 8: Loging to BellaDati
use your browser window and insert http://localhost:8080/login
check you are able to see your data as before
Conclusion
BellaDati application complex looks for data on drive D:\ psql\data now
C:\Program Files\Belladati\pgsql\data is not needed for application run.