389-DS Backup and Restoration
Home > Ubuntu > Ubuntu 22.04 > Ubuntu 22.04 389-DS server setup > 389-DS Backup and Restoration
Backing Up a 389 Directory Server Instance
Step 1: Stop the Directory Server
Before taking a backup, stop the Directory Server instance:
sudo dsctl INSTANCE_NAME stop
Replace `INSTANCE_NAME` with your actual instance name (e.g., `slapd-ldap`).
Step 2: Create the Backup
Run the `db2bak` command to create a backup:
sudo dsctl INSTANCE_NAME db2bak
This creates a backup directory under:
/var/lib/dirsrv/slapd-INSTANCE_NAME/bak/
with a timestamped folder containing the backup.
Step 3: Start the Directory Server
After the backup completes, restart the Directory Server instance:
sudo dsctl INSTANCE_NAME start
Step 4: Restoring the backup
a) Run the bak2db Command
Restore the backup to the database using the following command:
Replace `ANOTHER_INSTANCE_NAME` with your actual instance name (e.g., `slapd-example`).
dsctl slapd-ANOTHER_INSTANCE_NAME bak2db /var/lib/dirsrv/slapd-INSTANCE_NAME/bak/2024-12-12-INSTANCE_NAME-2024_12_12_18_07_38/
Replace the path with your actual backup directory if different.
b) Start the Directory Server
After restoring the backup, start the Directory Server instance:
dsctl slapd-ANOTHER_INSTANCE_NAME start
Home > Ubuntu > Ubuntu 22.04 > Ubuntu 22.04 389-DS server setup > 389-DS Backup and Restoration