This method involves replacing the disk at the backup data storage destination with a larger capacity disk, so that it does not run out of free space again. After replacing the disk, back up data to obtain a proper backup.
There are two methods of performing backup:
Follow the procedure below to recover the backup storage disk.
Back up files
If the disk at the backup data storage destination contains any required files, back up the files. It is not necessary to back up the backup data storage destination.
Temporarily save backup data
Save the backup data to a different directory.
The reason for saving the backup data is so that the data in the data storage destination can be recovered even if it is corrupted before you perform the next step. If there is no disk at the save destination and you consider that there is no risk of corruption at the data storage destination, delete the backup data.
The following example saves backup data from the backup data storage destination directory (/backup/inst1) under /mnt/usb/backup.
> mkdir /mnt/usb/backup/ > mv /backup/inst1/* /mnt/usb/backup/
Stop applications
Stop applications that are using the database.
Replace with a larger capacity disk
Replace the disk. Then, recover the volume configuration information.
Run backup
Log in to WebAdmin, and perform recovery operations. Refer to steps 2 ("Recover the backup data") and 3 ("Run backup") under "If failure occurred on the backup storage disk" in "17.1.1 Using WebAdmin".
Restore files
Restore the files backed up in step 1.
Delete temporarily saved backup data
If backup completes normally, the temporarily saved backup data becomes unnecessary and is deleted.
The following example deletes backup data that was temporarily saved in /mnt/usb.
> rm -rf /mnt/usb/backup
The procedure for recovering the backup data storage disk is described below.
There are two methods of taking action:
Performing recovery while the instance is active
Stopping the instance before performing recovery
The following table shows the different steps to be performed depending on whether you stop the instance.
No | Step | Instance stopped | |
---|---|---|---|
No | Yes | ||
1 | Back up files | Y | Y |
2 | Temporarily save backup data | Y | Y |
3 | Confirm that transaction log mirroring has stopped | Y | N |
4 | Stop output of archive logs | Y | N |
5 | Stop applications | N | Y |
6 | Stop the instance | N | Y |
7 | Replace with a larger capacity disk | Y | Y |
8 | Create a backup storage directory | Y | Y |
9 | Resume output of archive logs | Y | N |
10 | Resume transaction log mirroring | Y | N |
11 | Start the instance | N | Y |
12 | Run backup | Y | Y |
13 | Resume applications | N | Y |
14 | Restore files | Y | Y |
15 | Delete temporarily saved backup data | Y | Y |
Y: Required
N: Not required
The procedure is as follows:
Back up files
If the disk at the backup data storage destination contains any required files, back up the files. It is not necessary to back up the backup data storage destination.
Temporarily save backup data
Save the backup data to a different directory.
The reason for saving the backup data is so that the data in the data storage destination can be recovered even if it is corrupted before you perform the next step. If there is no disk at the save destination and you consider that there is no risk of corruption at the data storage destination, delete the backup data.
The following example saves backup data from the backup data storage destination directory (/backup/inst1) under /mnt/usb/backup.
> mkdir /mnt/usb/backup/ > mv /backup/inst1/* /mnt/usb/backup/
Confirm that transaction log mirroring has stopped
Use the following SQL function to confirm that transaction log mirroring has stopped.
postgres=# SELECT pgx_is_wal_multiplexing_paused(); pgx_is_wal_multiplexing_paused ------------------- t (1 row)
If transaction log mirroring has not stopped, then stop it using the following SQL function.
postgres=# SELECT pgx_pause_wal_multiplexing(); LOG: multiplexing of transaction log files has been stopped pgx_pause_wal_multiplexing ---------------------------- (1 row)
Stop output of archive logs
Transaction logs may accumulate during replacement of backup storage disk, and if the data storage destination disk or the transaction log storage destination disk becomes full, there is a risk that operations may not be able to continue.
To prevent this, use the following methods to stop output of archive logs.
Changing the archive_command parameter
Specify a command that will surely complete normally, such as "echo skipped archiving WAL file %f" or "/bin/true", so that archive logs will be regarded as having been output.
If you specify echo, a message is output to the server log, so it may be used as a reference when you conduct investigations.
Reloading the configuration file
Run the pg_ctl reload command or the pg_reload_conf SQL function.
If you simply want to stop output of errors without the risk that operations will not be able to continue, specify an empty string (") in archive_command and reload the configuration file.
Replace with a larger capacity disk
Replace the disk. Then, recover the volume configuration information.
Create a backup data storage destination
Create a backup data storage destination.
# mkdir /backup/inst1 # chown fsepuser:fsepuser /backup/inst1 # chmod 700 /backup/inst1
Refer to "3.2.2 Using Server Commands" for details.
Resume output of archive logs
Return the archive_command setting to its original value, and reload the configuration file.
Resume transaction log mirroring
Execute the pgx_resume_wal_multiplexing SQL function.
SELECT pgx_resume_wal_multiplexing()
Run backup
Use the pgx_dmpall command to back up the database cluster.
Specify the following value in the pgx_dmpall command:
Specify the data storage destination in the -D option. If the -D option is omitted, the value of the PGDATA environment variable is used by default.
> pgx_dmpall -D /database/inst1
Restore files
Restore the files backed up in step 1.
Delete temporarily saved backup data
If backup completes normally, the temporarily saved backup data becomes unnecessary and is deleted.
The following example deletes backup data that was temporarily saved in /mnt/usb.
> rm -rf /mnt/usb/backup
Back up files
If the disk at the backup data storage destination contains any required files, back up the files. It is not necessary to back up the backup data storage destination.
Temporarily save backup data
Save the backup data to a different directory.
The reason for saving the backup data is so that the data in the data storage destination can be recovered even if it is corrupted before you perform the next step. If there is no disk at the save destination and you consider that there is no risk of corruption at the data storage destination, delete the backup data.
The following example saves backup data from the backup data storage destination directory (/backup/inst1) under /mnt/usb/backup.
> mkdir /mnt/usb/backup/ > mv /backup/inst1/* /mnt/usb/backup/
Stop applications
Stop applications that are using the database.
Stop the instance
Stop the instance. Refer to "2.1.2 Using Server Commands" for information on how to stop an instance.
If the instance fails to stop, refer to "17.11 Actions in Response to Failure to Stop an Instance".
Replace with a larger capacity disk
Replace the disk. Then, recover the volume configuration information.
Create a backup data storage destination
Create a backup data storage destination.
# mkdir /backup/inst1 # chown fsepuser:fsepuser /backup/inst1 # chmod 700 /backup/inst1
Refer to "3.2.2 Using Server Commands" for details.
Start the instance
Start the instance. Refer to "2.1.2 Using Server Commands" for information on how to start an instance.
Run backup
Use the pgx_dmpall command to back up the database cluster.
Specify the following value in the pgx_dmpall command:
Specify the data storage destination in the -D option. If the -D option is omitted, the value of the PGDATA environment variable is used by default.
> pgx_dmpall -D /database/inst1
Resume applications
Resume applications that are using the database.
Restore files
Restore the files backed up in step 1.
Delete temporarily saved backup data
If backup completes normally, the temporarily saved backup data becomes unnecessary and is deleted.
The following example deletes backup data that was temporarily saved in /mnt/usb.
> rm -rf /mnt/usb/backup
See
Refer to "pgx_rcvall" and "pgx_dmpall" in the Reference for information on the pgx_rcvall command and pgx_dmpall command.
Refer to "Write Ahead Log" under "Server Administration" in the PostgreSQL Documentation for information on archive_command.
Refer to "B.1 WAL Mirroring Control Functions" for information on the pgx_is_wal_multiplexing_paused and pgx_resume_wal_multiplexing.