"Step-by-Step Guide: Changing PostgreSQL Data Storage in BDRSuite Backup Server/Offsite DR"

Steps to Change the PostgreSQL Data Storage Location in BDRSuite Backup Server/BDRSuite Offsite DR Server

KB ID: 115042
Challenge:
You need to migrate the internal PostgreSQL database files of the BDRSuite Backup Server/BDRSuite Offsite DR from one location to another due to increased storage space requirements resulting from the growing backup data size.
Cause:
As the backup data size increases in the BDRSuite Backup Server/BDRSuite Offsite DR server, the storage space of the PostgreSQL database also increases.
Solution:
For BDRSuite Backup Server/BDRSuite Offsite DR Installed on Windows:
Step 1: Find the PostgreSQL Data Storage Location
1. Open the Windows Registry editor.
2. Navigate to the following location, depending on the BDRSuite version:
  1. For BDRSuite v4.0 & Above: 
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VembuPostgreSQL
  1. For BDRSuite v3.9 & Below:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PostgreSQL
3. Double click on the 'ImagePath' to open it.
4. The path after "VembuPostgreSQL" -D or "PostgreSQL" -D in the value data represents the PSQL data folder location.
For example: if the path is "C:\ProgramFiles\Vembu\VembuBDR\..\PostgreSQL\10\bin\pg_ctl.exe" runservice -N "VembuPostgreSQL" -D "E:\PostgreSQLData", then "E:\PostgreSQLData" is the current PSQL data storage location.
Edit ImagePath
Step 2: Stop Services
Stop the following services using the Windows services (services.msc):
  1. VembuBDR or VembuOffsiteDR
  2. VembuPostgreSQL
Note: If the Vembu BDR tray application pops up after stopping the services, click on "No" to prevent the tray from automatically starting the Vembu BDR service.
Step 3: Copy PostgreSQLData Folder
Copy the PostgreSQLData folder to the new location where you want to migrate the PostgreSQL data. Ensure that the destination directory/folder has all permissions (read/write) for the local system user.
Step 4: Update Registry Settings
1. Open the Windows Registry editor.
2. Navigate to the following location, depending on the BDRSuite version
  1. BDRSuite 4.0 & Above:           HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VembuPostgreSQL
  2. BDRSuite 3.9 & Below:         HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PostgreSQL
3. Double click on the 'ImagePath' to open it.
4. Update the new PostgreSQLData folder path in the value data after "VembuPostgreSQL" -D or "PostgreSQL" -D. For example, if the new path is "F:\Newfolder\PostgreSQLData", then update the value data as follows:
   "C:\Program Files\Vembu\VembuBDR\..\PostgreSQL\10\bin\pg_ctl.exe" runservice -N "VembuPostgreSQL" -D "F:\Newfolder\PostgreSQLData".
Edit ImagePath
Step 5: Start Services
Start the following services using the Windows services (services.msc):
  1. VembuPostgreSQL
  2. VembuBDR or VembuOffsiteDR
For BDRSuite Backup Server/BDRSuite Offsite DR Server Installed on Ubuntu:
Step 1: Start an interactive PostgreSQL session and execute the following command to find the current data directory path: “show data_directory;”

Step 2: Stop BDRSuite Server/ BDRSuite Offsite DR and PostgreSQL services using below command:
  1. /etc/init.d/postgresql stop
  2. /etc/init.d/vembubdr stop (or) - /etc/init.d/Vembuoffsitedr stop
Step 3: Copy the  directory (main) from /var/lib/postgres/10/ (Path Found in Step 1) to a new location (/home/newloc/)using the below command
sudo rsync -av /var/lib/postgresql/13/main /home/newloc/main
Step 4: Open ‘postgresql.conf’ file and update ‘data_directory’ value with new path location
Ex: By default, configuration file can be found in following location: /etc/postgresql/9.6/main/postgresql.conf

Step 5: Start PostgreSQL service by executing following command: /etc/init.d/postgresql start
Step 6: Ensure the new data location is updated successfully by repeating Step 1
Step 7: Once the new location is updated successfully, start Vembu BDR (or) Vembu OffsiteDR service to resume backup/replication tasks.
If you encounter any complications during the process to change the PostgreSQL Data Storage location or require additional assistance, please don't hesitate to reach out to our dedicated BDRSuite Support team at vembu-support@vembu.com.