Backup and Restore
Overview
DaneOS employs a Point in Time Recovery (PITR) backup methodology, which significantly reduces both the time and disk space required to generate a complete daily backup. This approach allows you to restore your data to a specific point in time in a single step. You can define a backup policy, specifying the frequency of automated backups, which run seamlessly without requiring ongoing administrator intervention. Additionally, on-demand backups can be created independently of any predefined policies.
All backup and restore operations apply to central clusters. The backup process aligns with the deployment type specified in the modules
parameter during the installation command. Backups taken from a central cluster must only be restored to a central cluster. Failure to follow this guidance may result in data loss or corruption.
Efficient Disk Space Utilization
DaneOS backups duplicate all your original data only once during the initial backup. After this point, only modified data blocks are added to a continually growing pool. The backup system uses pointers to reference these blocks:
- Subsequent Backups: They only reference the new and modified blocks, avoiding redundancy.
- Restore Operations: Each backup contains the necessary pointers to reconstruct the database at a specific point in time. Older backups are unaffected by subsequent changes, ensuring integrity and reliability.
This efficient system drastically reduces disk space usage while maintaining full backup functionality.
Backup File Name and Location
By default, all backups are stored in the DaneOS backup directory located at /var/dane/backups
on the primary data node.
- On-Demand Backups: Automatically named in the format
20241217205720-r24.4
, which includes the date, time, and Dane release version. - Scheduled Backups: Initiated by your backup policy, named in the format
dane-scheduler-yyyymmddhhmmss
. Example:dane-scheduler-20191110000045-r24.4
for November 10th, 2019, at 00:00:45, and Dane release version.
All backup files include a time-to-live (TTL) parameter. When the TTL expires, the backup is deleted automatically, and its disk space is released. If no TTL value is specified, the default is 720 hours (30 days). While backups cannot be set to never expire, the maximum allowable TTL is 2,147,483,647 hours (~245,000 years), sufficient for most needs.
Backup Storage Options
Backups are stored locally by default:
- Local Storage: Backups remain on the primary data node in
/var/dane/backups
.
For disaster recovery planning, we recommend regularly exporting backups to a safe, remote location.
Automated Cleanup
The backup policy includes an automated cleanup mechanism that runs in the background. This process ensures that:
- Blocks no longer referenced by any backup files are deleted.
- When a backup reaches its expiration time, blocks exclusively linked to that backup (and since replaced) are safely removed.
This cleanup mechanism optimizes storage usage without manual intervention.
Backup and Restore Commands
All dc
commands must be run with sudo
privileges, as the root user is not available on this operating system. Before executing these commands, ensure you switch the current directory to /var
.
Backup Commands
These commands are used to manage backups efficiently:
-
Create a New Backup
sudo dc backup create
Generates a new backup of your DaneOS environment.
-
Delete a Backup
sudo dc backup delete
Deletes specific backup files based on policy or manual selection.
-
Export Backups
sudo dc backup export
Consolidates all backups into a single
.tar.gz
file for external transfer. -
Import Backups
sudo dc backup import
Restores a previously exported backup file into a running cluster.
-
List Available Backups
sudo dc backup list
Displays all completed backups.
-
View Backup Policy
sudo dc backup policy get
Shows the current backup policy configuration.
-
Set Backup Policy
sudo dc backup policy set
Configures the frequency, retention, and other parameters for automated backups.
Restore Command
The restore
command is used to recover your data from a backup:
- Restore a Backup
Restores data to a specific point in time or from a specified backup file.
sudo dc restore from-backup
By using these commands, you can automate, monitor, and efficiently manage backup and restore operations in DaneOS.