Home Assistant Database Management Project Plan#
First establish safe Recorder purge and repack settings. Then create and validate an export target for historical Home Assistant data.
Keep approximately 30 days of detailed history locally. Complete and verify the Recorder maintenance setup before starting the export work.
1. Configure Recorder Purge and Repack#
- 1.1 Set
purge_keep_daysto 30. - 1.2 Enable
auto_purge. - 1.3 Enable
auto_repack. - 1.4 Validate the configuration and restart Home Assistant if required.
- 1.5 Confirm that automatic purge and repack are active.
- 1.6 Confirm that the database remains within the 30-day retention period.
- 1.7 Confirm that sufficient free space remains for maintenance operations.
Do not begin the export-target work until the Recorder purge and repack settings have been configured and verified.
2. Choose the Export Target#
- 2.1 Choose the NAS location or other external storage target.
- 2.2 Confirm that it has enough space for the expected archive.
- 2.3 Confirm that Home Assistant can access the target without depending on it for normal operation.
The export target stores historical copies. It must not become the live MariaDB database location.
3. Define the Export#
- 3.1 Decide which historical entities and periods should be exported.
- 3.2 Choose a simple, readable export format.
- 3.3 Choose a consistent naming scheme for exported files.
- 3.4 Run the export every day at 08:30.
- 3.5 Export a rolling 48-hour window to avoid gaps.
- 3.6 Ensure overlapping exports are deduplicated or clearly organized.
4. Test the Export Target#
- 4.1 Run a test export for a limited period.
- 4.2 Confirm that the exported data can be opened and understood.
- 4.3 Confirm that the export target remains available after a restart.
- 4.4 Detect an unavailable target or failed export.
- 4.5 Do not purge local history after a failed export.
- 4.6 Confirm that Home Assistant continues operating if the target is offline.
5. Connect the Export to Retention#
- 5.1 Keep approximately 30 days of detailed history locally.
- 5.2 Purge older local data only after the export has been verified.
- 5.3 Repack the database only when reclaiming filesystem space is necessary.
- 5.4 Decide whether purging remains automatic or is controlled by export success.
6. Completion Criteria#
- 6.1 Recorder purge and repack settings are configured and verified.
- 6.2 The export target is selected and accessible.
- 6.3 A test export has been verified.
- 6.4 The daily export schedule is working.
- 6.5 Failed exports cannot silently trigger data removal.