DocsUsage GuideParameter Reference

Parameter Reference

Complete guide to configuration and runtime parameters

Setting Parameters

Use param <name> <value>; or p <name> <value>; to set parameters. Use show; to view current values.

Configuration File (pdu.ini)

PGDATARequired

PostgreSQL data directory path. Required for initialization and data extraction.

PGDATA=/var/lib/pgsql/14/data
ARCHIVE_DESTRequired

WAL source directory used by PDU. Use the archive directory when archiving is enabled, or a checked copy of PGDATA/pg_wal when it was not enabled.

ARCHIVE_DEST=/data/pdu-backup/incident/pg_wal
DISK_PATH

Disk device path for dropscan. Required for recovering dropped/truncated tables through disk fragment scanning.

DISK_PATH=/dev/mapper/centos-root
BLOCK_INTERVAL

Number of data blocks to skip during dropscan. Smaller values provide more comprehensive coverage but slower speed.

BLOCK_INTERVAL=20
PGDATA_EXCLUDERequired

Required for ds idx. List every PostgreSQL data directory located on DISK_PATH so existing database pages are excluded from the ISO image. Use comma-separated absolute paths with no spaces.

PGDATA_EXCLUDE=/home/15pg/data,/home/16pg/data,/home/17pg/data

WAL Scan Range

startwalstringDefault: empty (first file in archive)

Starting WAL file for scanning. Use when archive directory has too many files (>250) to improve efficiency.

p startwal 000000010000000100000047;
endwalstringDefault: empty (last file in archive)

Ending WAL file for scanning. Limits the scan range to specific WAL files.

p endwal 0000000100000001000000DC;

Time Range

starttimetimestampDefault: empty

Start time for filtering recovery data. Only records after this time will be recovered.

p starttime 2025-01-01 00:00:00;
endtimetimestampDefault: empty

End time for filtering recovery data. Only records before this time will be recovered.

p endtime 2025-01-15 23:59:59;

Recovery Mode

resmodeenumDefault: time

Data restoration mode. Determines how recovered data is grouped and displayed.

Valid Values
timeTime Range Mode - Recover all records within specified time range
txTransaction Mode - Recover records by specific transaction ID
p resmode tx;
restypeenumDefault: delete

Type of data to recover. Specifies whether to recover deleted or updated records.

Valid Values
deleteRecover deleted records (from DELETE operations)
updateRecover pre-update records (original data before UPDATE)
p restype update;

Export Settings

exmodeenumDefault: csv

Data export format. Determines the output file format for exported data.

Valid Values
csvExport as CSV files (comma-separated values)
sqlExport as SQL INSERT statements
p exmode sql;
encodingenumDefault: utf8

Character encoding for exported files. Choose based on your data's encoding.

Valid Values
utf8UTF-8 encoding (recommended for most cases)
gbkGBK encoding (for Chinese legacy systems)
p encoding gbk;

DropScan Parameters

dsoffnumberDefault: 0

DropScan start offset. Byte offset on disk to start scanning from. Useful for resuming interrupted scans.

p dsoff 1073741824;
blkiternumberDefault: 20

Block intervals during disk scanning. Lower values are slower but more thorough. Same as BLOCK_INTERVAL in pdu.ini.

p blkiter 5;
itmpcsvnumberDefault: 100

Maximum records per CSV file during dropscan. Controls file splitting for large recoveries.

p itmpcsv 1000;
idxmodeenumDefault: on

Index mode for dropscan. When enabled, uses pre-built disk index for faster scanning.

Valid Values
onUse the saved disk index (standard flow: configure PGDATA_EXCLUDE, then run ds idx directly)
offDirect disk scanning without index
p idxmode off;
isomodeenumDefault: on

Image isolation mode. It is enabled by default. After DISK_PATH and the required PGDATA_EXCLUDE list are configured, run ds idx directly to save restore/.dsiso/pgiso for later ds iso scanning.

Valid Values
onSave disk fragments as image files during ds idx
offScan directly from disk without saving images
p isomode off; # Only when image saving is intentionally disabled

Typical Configuration Example

pdu.ini
# PostgreSQL 数据目录
PGDATA=/var/lib/pgsql/14/data
# WAL 归档目录
ARCHIVE_DEST=/var/lib/pgsql/archive
# 磁盘路径(用于 dropscan)
DISK_PATH=/dev/sda1
# DISK_PATH 磁盘上的全部 PostgreSQL 数据目录(必填)
PGDATA_EXCLUDE=/var/lib/pgsql/14/data,/home/pg16/data
# 块间隔
BLOCK_INTERVAL=20
Recover Deleted Data in Transaction Mode
p resmode tx;
p startwal 000000010000000100000047;
scan orders;
restore del 1360536457;
Dropped Table Recovery Configuration
# pdu.ini
DISK_PATH=/dev/sda1
PGDATA_EXCLUDE=/var/lib/pgsql/14/data,/home/pg16/data

ds idx;
ds iso;
ds repair;
ds copy;